diff options
Diffstat (limited to 'ext/mysqli')
-rw-r--r-- | ext/mysqli/mysqli.c | 17 | ||||
-rw-r--r-- | ext/mysqli/mysqli_api.c | 22 | ||||
-rw-r--r-- | ext/mysqli/mysqli_driver.c | 2 | ||||
-rw-r--r-- | ext/mysqli/mysqli_exception.c | 2 | ||||
-rw-r--r-- | ext/mysqli/mysqli_fe.c | 14 | ||||
-rw-r--r-- | ext/mysqli/mysqli_nonapi.c | 8 | ||||
-rw-r--r-- | ext/mysqli/mysqli_priv.h | 4 | ||||
-rw-r--r-- | ext/mysqli/mysqli_prop.c | 8 | ||||
-rw-r--r-- | ext/mysqli/mysqli_result_iterator.c | 1 | ||||
-rw-r--r-- | ext/mysqli/mysqli_warning.c | 2 | ||||
-rw-r--r-- | ext/mysqli/php_mysqli_structs.h | 4 | ||||
-rw-r--r-- | ext/mysqli/tests/bug71863.phpt | 37 | ||||
-rw-r--r-- | ext/mysqli/tests/bug72701.phpt | 32 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_fetch_object.phpt | 37 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_fetch_object_oo.phpt | 15 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_get_client_stats.phpt | 8 |
16 files changed, 133 insertions, 80 deletions
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 594dd0da35..1e3cdad28f 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -34,6 +34,7 @@ #include "php_mysqli_structs.h" #include "mysqli_priv.h" #include "zend_exceptions.h" +#include "ext/spl/spl_exceptions.h" #include "zend_interfaces.h" ZEND_DECLARE_MODULE_GLOBALS(mysqli) @@ -282,7 +283,7 @@ static void mysqli_warning_free_storage(zend_object *object) /* {{{ mysqli_read_na */ static zval *mysqli_read_na(mysqli_object *obj, zval *retval) { - php_error_docref(NULL, E_ERROR, "Cannot read property"); + zend_throw_error(NULL, "Cannot read property"); return NULL; } /* }}} */ @@ -290,7 +291,7 @@ static zval *mysqli_read_na(mysqli_object *obj, zval *retval) /* {{{ mysqli_write_na */ static int mysqli_write_na(mysqli_object *obj, zval *newval) { - php_error_docref(NULL, E_ERROR, "Cannot write property"); + zend_throw_error(NULL, "Cannot write property"); return FAILURE; } /* }}} */ @@ -582,9 +583,7 @@ PHP_MINIT_FUNCTION(mysqli) mysqli_object_handlers.write_property = mysqli_write_property; mysqli_object_handlers.get_property_ptr_ptr = std_hnd->get_property_ptr_ptr; mysqli_object_handlers.has_property = mysqli_object_has_property; -#if PHP_VERSION_ID >= 50300 mysqli_object_handlers.get_debug_info = mysqli_object_get_debug_info; -#endif memcpy(&mysqli_object_driver_handlers, &mysqli_object_handlers, sizeof(zend_object_handlers)); mysqli_object_driver_handlers.free_obj = mysqli_driver_free_storage; memcpy(&mysqli_object_link_handlers, &mysqli_object_handlers, sizeof(zend_object_handlers)); @@ -603,11 +602,7 @@ PHP_MINIT_FUNCTION(mysqli) "MySqli persistent connection", module_number); INIT_CLASS_ENTRY(cex, "mysqli_sql_exception", mysqli_exception_methods); -#ifdef HAVE_SPL mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException); -#else - mysqli_exception_class_entry = zend_register_internal_class_ex(&cex, zend_ce_exception); -#endif mysqli_exception_class_entry->ce_flags |= ZEND_ACC_FINAL; zend_declare_property_long(mysqli_exception_class_entry, "code", sizeof("code")-1, 0, ZEND_ACC_PROTECTED); zend_declare_property_string(mysqli_exception_class_entry, "sqlstate", sizeof("sqlstate")-1, "00000", ZEND_ACC_PROTECTED); @@ -999,9 +994,7 @@ PHP_MINFO_FUNCTION(mysqli) /* Dependancies */ static const zend_module_dep mysqli_deps[] = { -#if defined(HAVE_SPL) && (PHP_VERSION_ID >= 50100) ZEND_MOD_REQUIRED("spl") -#endif #if defined(MYSQLI_USE_MYSQLND) ZEND_MOD_REQUIRED("mysqlnd") #endif @@ -1291,9 +1284,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags if (ce->constructor) { fci.size = sizeof(fci); - fci.function_table = &ce->function_table; ZVAL_UNDEF(&fci.function_name); - fci.symbol_table = NULL; fci.object = Z_OBJ_P(return_value); fci.retval = &retval; fci.params = NULL; @@ -1315,7 +1306,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags fcc.initialized = 1; fcc.function_handler = ce->constructor; - fcc.calling_scope = EG(scope); + fcc.calling_scope = zend_get_executed_scope(); fcc.called_scope = Z_OBJCE_P(return_value); fcc.object = Z_OBJ_P(return_value); diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 80cba4f85c..7b403dff08 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -354,7 +354,7 @@ PHP_FUNCTION(mysqli_stmt_bind_param) RETURN_FALSE; } - if (types_len != argc - start) { + if (types_len != (size_t)(argc - start)) { /* number of bind variables doesn't match number of elements in type definition string */ php_error_docref(NULL, E_WARNING, "Number of elements in type definition string doesn't match number of bind variables"); RETURN_FALSE; @@ -596,7 +596,7 @@ PHP_FUNCTION(mysqli_stmt_bind_result) MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); - if (argc != mysql_stmt_field_count(stmt->stmt)) { + if ((uint)argc != mysql_stmt_field_count(stmt->stmt)) { php_error_docref(NULL, E_WARNING, "Number of bind variables doesn't match number of fields in prepared statement"); RETURN_FALSE; } @@ -1267,7 +1267,11 @@ PHP_FUNCTION(mysqli_fetch_lengths) MYSQL_RES *result; zval *mysql_result; unsigned int i; - zend_ulong *ret; +#if defined(MYSQLI_USE_MYSQLND) + const size_t *ret; +#else + const zend_ulong *ret; +#endif if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) { return; @@ -1326,7 +1330,7 @@ PHP_FUNCTION(mysqli_field_seek) } MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); - if (fieldnr < 0 || fieldnr >= mysql_num_fields(result)) { + if (fieldnr < 0 || (uint)fieldnr >= mysql_num_fields(result)) { php_error_docref(NULL, E_WARNING, "Invalid field offset"); RETURN_FALSE; } @@ -1693,10 +1697,6 @@ static int mysqli_options_get_option_zval_type(int option) { switch (option) { #ifdef MYSQLI_USE_MYSQLND -#if PHP_MAJOR_VERSION == 6 - /* PHP-7 doesn't supprt unicode */ - case MYSQLND_OPT_NUMERIC_AND_DATETIME_AS_UNICODE: -#endif case MYSQLND_OPT_NET_CMD_BUFFER_SIZE: case MYSQLND_OPT_NET_READ_BUFFER_SIZE: #ifdef MYSQLND_STRING_TO_INT_CONVERSION @@ -1777,11 +1777,7 @@ PHP_FUNCTION(mysqli_options) MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED); #if !defined(MYSQLI_USE_MYSQLND) -#if PHP_API_VERSION < 20100412 - if ((PG(open_basedir) && PG(open_basedir)[0] != '\0') || PG(safe_mode)) { -#else if (PG(open_basedir) && PG(open_basedir)[0] != '\0') { -#endif if(mysql_option == MYSQL_OPT_LOCAL_INFILE) { RETURN_FALSE; } @@ -2337,7 +2333,7 @@ PHP_FUNCTION(mysqli_stmt_attr_set) MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID); if (mode_in < 0) { - php_error_docref(NULL, E_WARNING, "mode should be non-negative, %pd passed", mode_in); + php_error_docref(NULL, E_WARNING, "mode should be non-negative, " ZEND_LONG_FMT " passed", mode_in); RETURN_FALSE; } diff --git a/ext/mysqli/mysqli_driver.c b/ext/mysqli/mysqli_driver.c index a161911341..69db138575 100644 --- a/ext/mysqli/mysqli_driver.c +++ b/ext/mysqli/mysqli_driver.c @@ -150,7 +150,7 @@ const zend_function_entry mysqli_driver_methods[] = { PHP_FALIAS(embedded_server_start, mysqli_embedded_server_start, NULL) PHP_FALIAS(embedded_server_end, mysqli_embedded_server_end, NULL) #endif - {NULL, NULL, NULL} + PHP_FE_END }; /* }}} */ diff --git a/ext/mysqli/mysqli_exception.c b/ext/mysqli/mysqli_exception.c index ba3eebb19a..f533102d6e 100644 --- a/ext/mysqli/mysqli_exception.c +++ b/ext/mysqli/mysqli_exception.c @@ -32,7 +32,7 @@ /* {{{ mysqli_exception_methods[] */ const zend_function_entry mysqli_exception_methods[] = { - {NULL, NULL, NULL} + PHP_FE_END }; /* }}} */ diff --git a/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c index 817834dfc2..00dc1ca01a 100644 --- a/ext/mysqli/mysqli_fe.c +++ b/ext/mysqli/mysqli_fe.c @@ -63,10 +63,6 @@ ZEND_BEGIN_ARG_INFO(arginfo_class_mysqli_stmt_bind_param, 0) ZEND_ARG_VARIADIC_INFO(1, vars) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO(all_args_force_by_ref, 0) - ZEND_ARG_VARIADIC_INFO(1, vars) -ZEND_END_ARG_INFO() - ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_poll, 0, 0, 4) ZEND_ARG_ARRAY_INFO(1, read, 1) ZEND_ARG_ARRAY_INFO(1, write, 1) @@ -243,18 +239,14 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_fetch_object, 0, 0, 1) -#if PHP_VERSION_ID > 50399 MYSQLI_ZEND_ARG_OBJ_INFO_RESULT() ZEND_ARG_INFO(0, class_name) ZEND_ARG_ARRAY_INFO(0, params, 0) -#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_class_mysqli_fetch_object, 0, 0, 0) -#if PHP_VERSION_ID > 50399 ZEND_ARG_INFO(0, class_name) ZEND_ARG_ARRAY_INFO(0, params, 0) -#endif ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_kill, 0, 0, 2) @@ -583,7 +575,7 @@ const zend_function_entry mysqli_link_methods[] = { PHP_FALIAS(thread_safe, mysqli_thread_safe, arginfo_mysqli_no_params) PHP_FALIAS(use_result, mysqli_use_result, arginfo_mysqli_no_params) PHP_FALIAS(refresh,mysqli_refresh, arginfo_class_mysqli_refresh) - {NULL, NULL, NULL} + PHP_FE_END }; /* }}} */ @@ -608,7 +600,7 @@ const zend_function_entry mysqli_result_methods[] = { PHP_FALIAS(fetch_row, mysqli_fetch_row, arginfo_mysqli_no_params) PHP_FALIAS(field_seek, mysqli_field_seek, arginfo_class_mysqli_result_and_fieldnr) PHP_FALIAS(free_result, mysqli_free_result, arginfo_mysqli_no_params) - {NULL, NULL, NULL} + PHP_FE_END }; /* }}} */ @@ -641,7 +633,7 @@ const zend_function_entry mysqli_stmt_methods[] = { #if defined(MYSQLI_USE_MYSQLND) PHP_FALIAS(get_result, mysqli_stmt_get_result, arginfo_mysqli_no_params) #endif - {NULL, NULL, NULL} + PHP_FE_END }; /* }}} */ diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index 49db7bbfe6..e3efca25c6 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -156,7 +156,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne } else { mysql->persistent = persistent = TRUE; - hash_key = strpprintf(0, "mysqli_%s_%s%ld%s%s%s", SAFE_STR(hostname), SAFE_STR(socket), + hash_key = strpprintf(0, "mysqli_%s_%s" ZEND_LONG_FMT "%s%s%s", SAFE_STR(hostname), SAFE_STR(socket), port, SAFE_STR(username), SAFE_STR(dbname), SAFE_STR(passwd)); @@ -202,14 +202,14 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne } } if (MyG(max_links) != -1 && MyG(num_links) >= MyG(max_links)) { - php_error_docref(NULL, E_WARNING, "Too many open links (%pd)", MyG(num_links)); + php_error_docref(NULL, E_WARNING, "Too many open links (" ZEND_LONG_FMT ")", MyG(num_links)); goto err; } if (persistent && MyG(max_persistent) != -1 && (MyG(num_active_persistent) + MyG(num_inactive_persistent))>= MyG(max_persistent)) { - php_error_docref(NULL, E_WARNING, "Too many open persistent links (%pd)", + php_error_docref(NULL, E_WARNING, "Too many open persistent links (" ZEND_LONG_FMT ")", MyG(num_active_persistent) + MyG(num_inactive_persistent)); goto err; } @@ -1088,7 +1088,7 @@ PHP_FUNCTION(mysqli_begin_transaction) } MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID); if (flags < 0) { - php_error_docref(NULL, E_WARNING, "Invalid value for parameter flags (%pd)", flags); + php_error_docref(NULL, E_WARNING, "Invalid value for parameter flags (" ZEND_LONG_FMT ")", flags); err = TRUE; } if (!name_len) { diff --git a/ext/mysqli/mysqli_priv.h b/ext/mysqli/mysqli_priv.h index 0a1122a836..c34049c89e 100644 --- a/ext/mysqli/mysqli_priv.h +++ b/ext/mysqli/mysqli_priv.h @@ -78,10 +78,6 @@ extern void php_mysqli_report_error(const char *sqlstate, int errorno, const cha extern void php_mysqli_report_index(const char *query, unsigned int status); extern void php_mysqli_throw_sql_exception(char *sqlstate, int errorno, char *format, ...); -#ifdef HAVE_SPL -extern PHPAPI zend_class_entry *spl_ce_RuntimeException; -#endif - #define PHP_MYSQLI_EXPORT(__type) PHP_MYSQLI_API __type PHP_MYSQLI_EXPORT(zend_object *) mysqli_objects_new(zend_class_entry *); diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c index e679dcc48e..6b9e95ff7b 100644 --- a/ext/mysqli/mysqli_prop.c +++ b/ext/mysqli/mysqli_prop.c @@ -15,8 +15,6 @@ | Author: Georg Richter <georg@php.net> | | Andrey Hristov <andrey@php.net> | +----------------------------------------------------------------------+ - - $Id$ */ #ifdef HAVE_CONFIG_H @@ -289,7 +287,11 @@ static zval *result_type_read(mysqli_object *obj, zval *retval) static zval *result_lengths_read(mysqli_object *obj, zval *retval) { MYSQL_RES *p; - zend_ulong *ret; +#if defined(MYSQLI_USE_MYSQLND) + const size_t *ret; +#else + const zend_ulong *ret; +#endif uint field_count; CHECK_STATUS(MYSQLI_STATUS_VALID); diff --git a/ext/mysqli/mysqli_result_iterator.c b/ext/mysqli/mysqli_result_iterator.c index 0a33bb4f67..d3f62260e6 100644 --- a/ext/mysqli/mysqli_result_iterator.c +++ b/ext/mysqli/mysqli_result_iterator.c @@ -153,6 +153,7 @@ zend_object_iterator_funcs php_mysqli_result_iterator_funcs = { php_mysqli_result_iterator_current_key, php_mysqli_result_iterator_move_forward, php_mysqli_result_iterator_rewind, + NULL }; /* }}} */ diff --git a/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c index d789627e7f..063ed56c2d 100644 --- a/ext/mysqli/mysqli_warning.c +++ b/ext/mysqli/mysqli_warning.c @@ -315,7 +315,7 @@ PHP_METHOD(mysqli_warning, __construct) const zend_function_entry mysqli_warning_methods[] = { PHP_ME(mysqli_warning, __construct, NULL, ZEND_ACC_PROTECTED) PHP_ME(mysqli_warning, next, NULL, ZEND_ACC_PUBLIC) - {NULL, NULL, NULL} + PHP_FE_END }; /* }}} */ diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h index d231b774e1..c75023c3ad 100644 --- a/ext/mysqli/php_mysqli_structs.h +++ b/ext/mysqli/php_mysqli_structs.h @@ -216,10 +216,6 @@ extern zend_object_iterator *php_mysqli_result_get_iterator(zend_class_entry *ce extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, zend_long fetchtype); -#ifdef HAVE_SPL -extern PHPAPI zend_class_entry *spl_ce_RuntimeException; -#endif - #define MYSQLI_DISABLE_MQ if (mysql->multi_query) { \ mysql_set_server_option(mysql->mysql, MYSQL_OPTION_MULTI_STATEMENTS_OFF); \ mysql->multi_query = 0; \ diff --git a/ext/mysqli/tests/bug71863.phpt b/ext/mysqli/tests/bug71863.phpt new file mode 100644 index 0000000000..889792822f --- /dev/null +++ b/ext/mysqli/tests/bug71863.phpt @@ -0,0 +1,37 @@ +--TEST-- +Bug #71863 Segfault when EXPLAIN with "Unknown Column" Error +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once('skipifconnectfailure.inc'); +require_once("connect.inc"); +if (!$IS_MYSQLND) { + die("skip mysqlnd only test"); +} +?> +--FILE-- +<?php +require_once("connect.inc"); + +$req = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + +// create db and table for test +mysqli_query($req, "DROP TABLE IF EXISTS test_bug_71863") or die(mysqli_error($req)); +mysqli_query($req, "CREATE TABLE test_bug_71863 (id INT UNSIGNED NOT NULL DEFAULT 0)") or die(mysqli_error($req)); + +// segfault if EXPLAIN + "Unknown column" error +mysqli_query($req, "EXPLAIN SELECT `id` FROM `test_bug_71863` WHERE `owner_id` = '2' AND `object_id` = '1' AND type = '0'") or die(mysqli_error($req)."\n"); + +?> +--CLEAN-- +<?php +require_once("connect.inc"); +if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()); +if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bug_71863")) + printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); +mysqli_close($link); +?> +--EXPECTF-- +Warning: mysqli_query(): (42S22/1054): Unknown column 'owner_id' in 'where clause' in %sbug71863.php on line %d +Unknown column 'owner_id' in 'where clause'
\ No newline at end of file diff --git a/ext/mysqli/tests/bug72701.phpt b/ext/mysqli/tests/bug72701.phpt new file mode 100644 index 0000000000..f0eb174172 --- /dev/null +++ b/ext/mysqli/tests/bug72701.phpt @@ -0,0 +1,32 @@ +--TEST-- +Bug #72701 mysqli_get_host_info() wrong output +--SKIPIF-- +<?php +require_once('skipif.inc'); +require_once('skipifconnectfailure.inc'); +require_once("connect.inc"); + +if ("127.0.0.1" != $host && "localhost" != $host) { + die("skip require 127.0.0.1 connection"); +} + +?> +--FILE-- +<?php + +require_once("connect.inc"); + +$con = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); + +if (mysqli_connect_errno()) { + echo "Failed to connect to MySQL: " . mysqli_connect_error(); +} + +var_dump(preg_match(",(127.0.0.1|localhost) via .*,i", mysqli_get_host_info($con))); + +mysqli_close($con); +?> +==DONE== +--EXPECT-- +int(1) +==DONE== diff --git a/ext/mysqli/tests/mysqli_fetch_object.phpt b/ext/mysqli/tests/mysqli_fetch_object.phpt index 9706ceac84..dff91531ce 100644 --- a/ext/mysqli/tests/mysqli_fetch_object.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object.phpt @@ -59,18 +59,25 @@ require_once('skipifconnectfailure.inc'); } - $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array()); - - if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { - printf("[006] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($obj); - } + try { + $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array()); + if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { + printf("[006] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($obj); + } + } catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; + } - $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a')); - if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { - printf("[007] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - var_dump($obj); - } + try { + $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a')); + if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { + printf("[007] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + var_dump($obj); + } + } catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; + } $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b')); if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) { @@ -140,12 +147,8 @@ require_once('skipifconnectfailure.inc'); --EXPECTF-- [E_WARNING] mysqli_fetch_object() expects at least 1 parameter, 0 given in %s on line %d [E_WARNING] mysqli_fetch_object() expects parameter 1 to be mysqli_result, null given in %s on line %d -[E_WARNING] Missing argument 1 for mysqli_fetch_object_construct::__construct() in %s on line %d -[E_WARNING] Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d -[E_NOTICE] Undefined variable: a in %s on line %d -[E_NOTICE] Undefined variable: b in %s on line %d -[E_WARNING] Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d -[E_NOTICE] Undefined variable: b in %s on line %d +Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 0 passed and exactly 2 expected +Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 1 passed and exactly 2 expected NULL NULL [E_WARNING] mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d diff --git a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt index 82e311cc72..8fac044139 100644 --- a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt @@ -89,10 +89,14 @@ require_once('skipifconnectfailure.inc'); mysqli_fetch_object($res); } - $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a')); - if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { - printf("[010] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); - var_dump($obj); + try { + $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a')); + if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) { + printf("[010] Object seems wrong. [%d] %s\n", $mysqli->errno, $mysqli->error); + var_dump($obj); + } + } catch (Throwable $e) { + echo "Exception: " . $e->getMessage() . "\n"; } $obj = $res->fetch_object('mysqli_fetch_object_construct', array('a', 'b')); @@ -132,8 +136,7 @@ require_once('skipifconnectfailure.inc'); [0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d [0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, object given in %s on line %d [0] Argument 2 passed to mysqli_result::fetch_object() must be of the type array, null given in %s on line %d -[E_WARNING] Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %d -[E_NOTICE] Undefined variable: b in %s on line %d +Exception: Too few arguments to function mysqli_fetch_object_construct::__construct(), 1 passed and exactly 2 expected NULL NULL [E_WARNING] mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %d diff --git a/ext/mysqli/tests/mysqli_get_client_stats.phpt b/ext/mysqli/tests/mysqli_get_client_stats.phpt index f0c4129dee..3e80c78e74 100644 --- a/ext/mysqli/tests/mysqli_get_client_stats.phpt +++ b/ext/mysqli/tests/mysqli_get_client_stats.phpt @@ -958,7 +958,7 @@ if (!mysqli_query($link, "DROP SERVER IF EXISTS myself")) mysqli_close($link); ?> --EXPECTF-- -array(161) { +array(163) { [%u|b%"bytes_sent"]=> %unicode|string%(1) "0" [%u|b%"bytes_received"]=> @@ -1125,10 +1125,14 @@ array(161) { %unicode|string%(1) "0" [%u|b%"mem_strndup_count"]=> %unicode|string%(1) "0" - [%u|b%"mem_estndup_count"]=> + [%u|b%"mem_estrdup_count"]=> %unicode|string%(1) "0" [%u|b%"mem_strdup_count"]=> %unicode|string%(1) "0" + [%u|b%"mem_edupl_count"]=> + %unicode|string%(1) "0" + [%u|b%"mem_dupl_count"]=> + %unicode|string%(1) "0" [%u|b%"proto_text_fetched_null"]=> %unicode|string%(1) "0" [%u|b%"proto_text_fetched_bit"]=> |