diff options
author | Christopher Jones <sixd@php.net> | 2012-10-18 17:40:15 -0700 |
---|---|---|
committer | Christopher Jones <sixd@php.net> | 2012-10-18 17:40:15 -0700 |
commit | 18c077adfc9dbc3cca252941b06b7170ee88aa16 (patch) | |
tree | 417a7f9d7c7f0b11d9d11d8539173c784404cf5e /ext/mysqli/mysqli_api.c | |
parent | 8effd6fe68b1041537d8670ca2e5d43a6bb80925 (diff) | |
parent | 51fe5bcd099c167a07c6e1e5202c4700fa1bcecc (diff) | |
download | php-git-18c077adfc9dbc3cca252941b06b7170ee88aa16.tar.gz |
Merge branch 'master' of https://git.php.net/repository/php-src
* 'master' of https://git.php.net/repository/php-src: (75 commits)
- Updated to version 2012.7 (2012g)
SUpport newer bisons.
Merge the fix for #61964 to 5.3, which will fix #63304
add protection against core dumps if the underlying library returns 0x0 for some reason
indent
better fix for #63055
Fixed bug #63055 (Segfault in zend_gc with SF2 testsuite)
I forgot that inconsistent is only avaliable in debug mode
Add comments
Fixed bug #63055 (Segfault in zend_gc with SF2 testsuite)
PHP 5.3.18 NEWS
fix NEWS
fix compilation failure on 32/64bit linux systems, when libmysql is used with ext/mysql
fix build with libmysql on Ubuntu 12.04 x64 probably other mixed 32/64 systems
fix newly introduced segfault
Fixed bug #63248 Load multiple magic files on win
Cover have_ssl=NO and have_ssl=DISABLED
Updating expected output in anticipation of mysqlnd_auth.c path
updated NEWS
Refactor to using a stack based zval instead of dynamic allocation
...
Diffstat (limited to 'ext/mysqli/mysqli_api.c')
-rw-r--r-- | ext/mysqli/mysqli_api.c | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 394073610c..1ac9173eec 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -566,14 +566,17 @@ PHP_FUNCTION(mysqli_character_set_name) { MY_MYSQL *mysql; zval *mysql_link; + const char *cs_name; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID); - - RETURN_STRING((char *)mysql_character_set_name(mysql->mysql), 1); + cs_name = mysql_character_set_name(mysql->mysql); + if (cs_name) { + RETURN_STRING(cs_name, 1); + } } /* }}} */ @@ -732,12 +735,16 @@ PHP_FUNCTION(mysqli_error) { MY_MYSQL *mysql; zval *mysql_link; + const char *err; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID); - RETURN_STRING((char *)mysql_error(mysql->mysql),1); + err = mysql_error(mysql->mysql); + if (err) { + RETURN_STRING(err, 1); + } } /* }}} */ @@ -1268,7 +1275,10 @@ PHP_FUNCTION(mysqli_free_result) Get MySQL client info */ PHP_FUNCTION(mysqli_get_client_info) { - RETURN_STRING((char *)mysql_get_client_info(), 1); + const char * info = mysql_get_client_info(); + if (info) { + RETURN_STRING(info, 1); + } } /* }}} */ @@ -1320,15 +1330,18 @@ PHP_FUNCTION(mysqli_get_server_info) { MY_MYSQL *mysql; zval *mysql_link = NULL; + const char *info; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID); - RETURN_STRING((char *)mysql_get_server_info(mysql->mysql), 1); + info = mysql_get_server_info(mysql->mysql); + if (info) { + RETURN_STRING(info, 1); + } } - /* }}} */ /* {{{ proto int mysqli_get_server_version(object link) @@ -1361,7 +1374,9 @@ PHP_FUNCTION(mysqli_info) MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID); info = mysql_info(mysql->mysql); - RETURN_STRING((info) ? (char *)info : "", 1); + if (info) { + RETURN_STRING(info, 1); + } } /* }}} */ @@ -2096,12 +2111,16 @@ PHP_FUNCTION(mysqli_sqlstate) { MY_MYSQL *mysql; zval *mysql_link; + const char *state; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_CONN(mysql, &mysql_link, MYSQLI_STATUS_VALID); - RETURN_STRING((char *)mysql_sqlstate(mysql->mysql),1); + state = mysql_sqlstate(mysql->mysql); + if (state) { + RETURN_STRING(state, 1); + } } /* }}} */ @@ -2279,13 +2298,17 @@ PHP_FUNCTION(mysqli_stmt_error) { MY_STMT *stmt; zval *mysql_stmt; + const char * err; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_STMT(stmt, &mysql_stmt, MYSQLI_STATUS_INITIALIZED); - RETURN_STRING((char *)mysql_stmt_error(stmt->stmt),1); + err = mysql_stmt_error(stmt->stmt); + if (err) { + RETURN_STRING(err, 1); + } } /* }}} */ @@ -2424,13 +2447,17 @@ PHP_FUNCTION(mysqli_stmt_sqlstate) { MY_STMT *stmt; zval *mysql_stmt; + const char * state; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) { return; } MYSQLI_FETCH_RESOURCE_STMT(stmt, &mysql_stmt, MYSQLI_STATUS_VALID); - RETURN_STRING((char *)mysql_stmt_sqlstate(stmt->stmt),1); + state = mysql_stmt_sqlstate(stmt->stmt); + if (state) { + RETURN_STRING(state, 1); + } } /* }}} */ |