diff options
113 files changed, 1278 insertions, 802 deletions
diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index ba12ea1a80..cbfbb451bc 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -312,7 +312,7 @@ zval *mysqli_read_property(zend_object *object, zend_string *name, int type, voi } if (hnd) { - if (hnd->read_func(obj, rv, type == BP_VAR_IS) == SUCCESS || type != BP_VAR_IS) { + if (hnd->read_func(obj, rv, type == BP_VAR_IS) == SUCCESS) { retval = rv; } else { retval = &EG(uninitialized_zval); @@ -409,6 +409,7 @@ HashTable *mysqli_object_get_debug_info(zend_object *object, int *is_temp) ZEND_HASH_FOREACH_PTR(props, entry) { zval rv; zval *value; + value = mysqli_read_property(object, entry->name, BP_VAR_IS, 0, &rv); if (value != &EG(uninitialized_zval)) { zend_hash_add(retval, entry->name, value); @@ -470,7 +471,7 @@ static MYSQLND *mysqli_convert_zv_to_mysqlnd(zval * zv) mysqli_object *intern = Z_MYSQLI_P(zv); if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) { /* We know that we have a mysqli object, so this failure should be emitted */ - php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(intern->zo.ce->name)); + zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(intern->zo.ce->name)); return NULL; } mysql = (MY_MYSQL *)(my_res->ptr); diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index ba725e6c51..4ba77579da 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -731,7 +731,7 @@ static int mysqlnd_zval_array_to_mysqlnd_array(zval *in_array, MYSQLND ***out_ar int i = 0, current = 0; if (Z_TYPE_P(in_array) != IS_ARRAY) { - return 0; + return SUCCESS; } *out_array = ecalloc(zend_hash_num_elements(Z_ARRVAL_P(in_array)) + 1, sizeof(MYSQLND *)); ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(in_array), elem) { @@ -744,18 +744,18 @@ static int mysqlnd_zval_array_to_mysqlnd_array(zval *in_array, MYSQLND ***out_ar MYSQLI_RESOURCE *my_res; mysqli_object *intern = Z_MYSQLI_P(elem); if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) { - php_error_docref(NULL, E_WARNING, "[%d] Couldn't fetch %s", i, ZSTR_VAL(intern->zo.ce->name)); - continue; + zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(intern->zo.ce->name)); + return FAILURE; } mysql = (MY_MYSQL*) my_res->ptr; if (MYSQLI_STATUS_VALID && my_res->status < MYSQLI_STATUS_VALID) { - php_error_docref(NULL, E_WARNING, "Invalid object %d or resource %s", i, ZSTR_VAL(intern->zo.ce->name)); - continue; + zend_throw_error(NULL, "%s object is not fully initialized", ZSTR_VAL(intern->zo.ce->name)); + return FAILURE; } (*out_array)[current++] = mysql->mysql; } } ZEND_HASH_FOREACH_END(); - return 0; + return SUCCESS; } /* }}} */ @@ -859,10 +859,16 @@ PHP_FUNCTION(mysqli_poll) } if (r_array != NULL) { - mysqlnd_zval_array_to_mysqlnd_array(r_array, &new_r_array); + if (mysqlnd_zval_array_to_mysqlnd_array(r_array, &new_r_array) == FAILURE) { + efree(new_r_array); + RETURN_THROWS(); + } } if (e_array != NULL) { - mysqlnd_zval_array_to_mysqlnd_array(e_array, &new_e_array); + if (mysqlnd_zval_array_to_mysqlnd_array(e_array, &new_e_array) == FAILURE) { + efree(new_e_array); + RETURN_THROWS(); + } } ret = mysqlnd_poll(new_r_array, new_e_array, &new_dont_poll_array, sec, usec, &desc_num); diff --git a/ext/mysqli/mysqli_prop.c b/ext/mysqli/mysqli_prop.c index 45033057c0..ef564a35d5 100644 --- a/ext/mysqli/mysqli_prop.c +++ b/ext/mysqli/mysqli_prop.c @@ -30,9 +30,8 @@ #define CHECK_STATUS(value, quiet) \ if (!obj->ptr || ((MYSQLI_RESOURCE *)obj->ptr)->status < value ) { \ if (!quiet) { \ - php_error_docref(NULL, E_WARNING, "Property access is not allowed yet"); \ + zend_throw_error(NULL, "Property access is not allowed yet"); \ } \ - ZVAL_FALSE(retval); \ return FAILURE; \ } \ @@ -40,9 +39,8 @@ MYSQL *p; \ if (!obj->ptr || !(MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr) { \ if (!quiet) { \ - php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); \ + zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(obj->zo.ce->name)); \ } \ - ZVAL_FALSE(retval);\ return FAILURE; \ } else { \ CHECK_STATUS(statusval, quiet);\ @@ -53,9 +51,8 @@ if (!obj->ptr || !(MY_MYSQL *)((MYSQLI_RESOURCE *)(obj->ptr))->ptr) { \ MYSQL_RES *p; \ if (!obj->ptr) { \ if (!quiet) { \ - php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); \ + zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(obj->zo.ce->name)); \ } \ - ZVAL_NULL(retval);\ return FAILURE; \ } else { \ CHECK_STATUS(statusval, quiet);\ @@ -66,9 +63,8 @@ if (!obj->ptr) { \ MYSQL_STMT *p; \ if (!obj->ptr) { \ if (!quiet) { \ - php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); \ + zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(obj->zo.ce->name)); \ } \ - ZVAL_NULL(retval);\ return FAILURE; \ } else { \ CHECK_STATUS(statusval, quiet); \ diff --git a/ext/mysqli/mysqli_warning.c b/ext/mysqli/mysqli_warning.c index 5ba18c4f45..380d2e3fd9 100644 --- a/ext/mysqli/mysqli_warning.c +++ b/ext/mysqli/mysqli_warning.c @@ -203,9 +203,8 @@ static int mysqli_warning_message(mysqli_object *obj, zval *retval, zend_bool qu if (!obj->ptr || !((MYSQLI_RESOURCE *)(obj->ptr))->ptr) { if (!quiet) { - php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); + zend_throw_error(NULL, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); } - ZVAL_NULL(retval); return FAILURE; } @@ -224,9 +223,8 @@ static int mysqli_warning_sqlstate(mysqli_object *obj, zval *retval, zend_bool q if (!obj->ptr || !((MYSQLI_RESOURCE *)(obj->ptr))->ptr) { if (!quiet) { - php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); + zend_throw_error(NULL, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); } - ZVAL_NULL(retval); return FAILURE; } @@ -245,9 +243,8 @@ static int mysqli_warning_errno(mysqli_object *obj, zval *retval, zend_bool quie if (!obj->ptr || !((MYSQLI_RESOURCE *)(obj->ptr))->ptr) { if (!quiet) { - php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); + zend_throw_error(NULL, "Couldn't fetch %s", ZSTR_VAL(obj->zo.ce->name)); } - ZVAL_NULL(retval); return FAILURE; } diff --git a/ext/mysqli/php_mysqli_structs.h b/ext/mysqli/php_mysqli_structs.h index 249b1b553d..02d97b29bc 100644 --- a/ext/mysqli/php_mysqli_structs.h +++ b/ext/mysqli/php_mysqli_structs.h @@ -246,13 +246,13 @@ extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * resul MYSQLI_RESOURCE *my_res; \ mysqli_object *intern = Z_MYSQLI_P(__id); \ if (!(my_res = (MYSQLI_RESOURCE *)intern->ptr)) {\ - php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(intern->zo.ce->name));\ - RETURN_FALSE;\ + zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(intern->zo.ce->name));\ + RETURN_THROWS();\ }\ __ptr = (__type)my_res->ptr; \ if (__check && my_res->status < __check) { \ - php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \ - RETURN_FALSE;\ + zend_throw_error(NULL, "%s object is not fully initialized", ZSTR_VAL(intern->zo.ce->name)); \ + RETURN_THROWS();\ }\ } @@ -260,12 +260,12 @@ extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * resul { \ MYSQLI_RESOURCE *my_res; \ if (!(my_res = (MYSQLI_RESOURCE *)(__obj->ptr))) {\ - php_error_docref(NULL, E_WARNING, "Couldn't fetch %s", ZSTR_VAL(intern->zo.ce->name));\ - return;\ - }\ + zend_throw_error(NULL, "%s object is already closed", ZSTR_VAL(intern->zo.ce->name));\ + return;\ + }\ __ptr = (__type)my_res->ptr; \ if (__check && my_res->status < __check) { \ - php_error_docref(NULL, E_WARNING, "invalid object or resource %s\n", ZSTR_VAL(intern->zo.ce->name)); \ + zend_throw_error(NULL, "%s object is not fully initialized", ZSTR_VAL(intern->zo.ce->name)); \ return;\ }\ } diff --git a/ext/mysqli/tests/bug28817.phpt b/ext/mysqli/tests/bug28817.phpt index 1837048517..011d35e011 100644 --- a/ext/mysqli/tests/bug28817.phpt +++ b/ext/mysqli/tests/bug28817.phpt @@ -22,7 +22,11 @@ require_once('skipifconnectfailure.inc'); $mysql = new my_mysql(); var_dump($mysql->p_test); - var_dump($mysql->errno); + try { + $mysql->errno; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } $mysql->connect($host, $user, $passwd, $db, $port, $socket); $mysql->select_db("nonexistingdb"); @@ -38,7 +42,5 @@ array(2) { [1]=> %s(3) "bar" } - -Warning: main(): Couldn't fetch my_mysql in %s on line %d -bool(false) +my_mysql object is already closed bool(true) diff --git a/ext/mysqli/tests/bug36420.phpt b/ext/mysqli/tests/bug36420.phpt index 6dd03b37f0..619c41bd44 100644 --- a/ext/mysqli/tests/bug36420.phpt +++ b/ext/mysqli/tests/bug36420.phpt @@ -14,15 +14,22 @@ $mysqli = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); $result = $mysqli->query('select 1'); $result->close(); -echo $result->num_rows; +try { + $result->num_rows; +} catch (Error $exception) { + echo $exception->getMessage() . "\n"; +} $mysqli->close(); -echo $result->num_rows; +try { + $result->num_rows; +} catch (Error $exception) { + echo $exception->getMessage() . "\n"; +} echo "Done\n"; ?> --EXPECTF-- -Warning: main(): Couldn't fetch mysqli_result in %s on line %d - -Warning: main(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed +mysqli_result object is already closed Done diff --git a/ext/mysqli/tests/bug36802.phpt b/ext/mysqli/tests/bug36802.phpt index 65e6d9a8ce..387d73338e 100644 --- a/ext/mysqli/tests/bug36802.phpt +++ b/ext/mysqli/tests/bug36802.phpt @@ -15,27 +15,35 @@ Bug #36802 (crashes with with mysqli_set_charset()) /* following operations should not work */ if (method_exists($mysql, 'set_charset')) { - $x[0] = @$mysql->set_charset('utf8'); + try { + $mysql->set_charset('utf8'); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } } else { $x[0] = false; } - $x[1] = @$mysql->query("SELECT 'foo' FROM DUAL"); + + try { + $mysql->query("SELECT 'foo' FROM DUAL"); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } /* following operations should work */ - $x[2] = ($mysql->client_version > 0); - $x[3] = $mysql->errno; + $x[1] = ($mysql->client_version > 0); + $x[2] = $mysql->errno; + $mysql->close(); var_dump($x); ?> --EXPECT-- -array(4) { - [0]=> - bool(false) +mysqli object is not fully initialized +mysqli object is not fully initialized +array(2) { [1]=> - bool(false) - [2]=> bool(true) - [3]=> + [2]=> int(0) } diff --git a/ext/mysqli/tests/bug63398.phpt b/ext/mysqli/tests/bug63398.phpt index b6e6c2549d..278c5c4a96 100644 --- a/ext/mysqli/tests/bug63398.phpt +++ b/ext/mysqli/tests/bug63398.phpt @@ -19,18 +19,14 @@ mysqli_close($link); $read = $error = $reject = array(); $read[] = $error[] = $reject[] = $link; -mysqli_poll($read, $error, $reject, 1); +try { + mysqli_poll($read, $error, $reject, 1); +} catch (Error $exception) { + echo $exception->getMessage() . "\n"; +} echo "okey"; ?> --EXPECTF-- -Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d - -Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d - -Warning: mysqli_poll(): No stream arrays were passed in %sbug63398.php on line %d - -Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d - -Warning: mysqli_poll(): [1] Couldn't fetch mysqli in %sbug63398.php on line %d +mysqli object is already closed okey diff --git a/ext/mysqli/tests/bug73462.phpt b/ext/mysqli/tests/bug73462.phpt index 5fb978feb1..f82115cf6c 100644 --- a/ext/mysqli/tests/bug73462.phpt +++ b/ext/mysqli/tests/bug73462.phpt @@ -19,7 +19,11 @@ require_once('skipifconnectfailure.inc'); /* Failed connection to invalid host */ $mysql_2 = @new mysqli(' !!! invalid !!! ', $user, $passwd, $db); - @$mysql_2->close(); + try { + $mysql_2->close(); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } /* Re-use persistent connection */ $mysql_3 = new mysqli('p:'.$host, $user, $passwd, $db); @@ -38,4 +42,5 @@ require_once('skipifconnectfailure.inc'); print "done!"; ?> --EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/bug75448.phpt b/ext/mysqli/tests/bug75448.phpt index d4b1b05f51..929b152769 100644 --- a/ext/mysqli/tests/bug75448.phpt +++ b/ext/mysqli/tests/bug75448.phpt @@ -11,9 +11,11 @@ require_once('skipifconnectfailure.inc'); require_once 'connect.inc'; $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket); mysqli_close($link); -$stmt = mysqli_prepare($link, 'SELECT VERSION()'); -var_dump($stmt); -?> ---EXPECTF-- -Warning: mysqli_prepare(): Couldn't fetch mysqli in %s on line %d -bool(false) + +try { + mysqli_prepare($link, 'SELECT VERSION()'); +} catch (Error $exception) { + echo $exception->getMessage() . "\n"; +} +--EXPECT-- +mysqli object is already closed diff --git a/ext/mysqli/tests/mysqli_affected_rows.phpt b/ext/mysqli/tests/mysqli_affected_rows.phpt index 81a7f5b6de..c74d0bc0ca 100644 --- a/ext/mysqli/tests/mysqli_affected_rows.phpt +++ b/ext/mysqli/tests/mysqli_affected_rows.phpt @@ -110,8 +110,11 @@ mysqli_affected_rows() mysqli_close($link); - if (false !== ($tmp = @mysqli_affected_rows($link))) - printf("[033] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_affected_rows($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -120,4 +123,5 @@ mysqli_affected_rows() require_once("clean_table.inc"); ?> --EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_affected_rows_oo.phpt b/ext/mysqli/tests/mysqli_affected_rows_oo.phpt index 7a6a5be996..054971f6ee 100644 --- a/ext/mysqli/tests/mysqli_affected_rows_oo.phpt +++ b/ext/mysqli/tests/mysqli_affected_rows_oo.phpt @@ -11,8 +11,11 @@ mysqli->affected_rows require_once("connect.inc"); $mysqli = new mysqli(); - if (false !== ($tmp = @$mysqli->affected_rows)) - printf("[000a] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $mysqli->affected_rows; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) { printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", @@ -101,8 +104,11 @@ mysqli->affected_rows $mysqli->close(); - if (false !== ($tmp = @$mysqli->affected_rows)) - printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $mysqli->affected_rows; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -111,4 +117,6 @@ mysqli->affected_rows require_once("clean_table.inc"); ?> --EXPECT-- +Property access is not allowed yet +Property access is not allowed yet done! diff --git a/ext/mysqli/tests/mysqli_autocommit.phpt b/ext/mysqli/tests/mysqli_autocommit.phpt index 99bd7d29c5..908cb315c3 100644 --- a/ext/mysqli/tests/mysqli_autocommit.phpt +++ b/ext/mysqli/tests/mysqli_autocommit.phpt @@ -122,14 +122,17 @@ mysqli_autocommit() mysqli_close($link); - if (false !== ($tmp = @mysqli_autocommit($link, false))) - printf("[033] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_autocommit($link, false); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; -?> --CLEAN-- <?php require_once("clean_table.inc"); ?> --EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_autocommit_oo.phpt b/ext/mysqli/tests/mysqli_autocommit_oo.phpt index 93ab10e605..cca7dab0b5 100644 --- a/ext/mysqli/tests/mysqli_autocommit_oo.phpt +++ b/ext/mysqli/tests/mysqli_autocommit_oo.phpt @@ -124,8 +124,11 @@ mysqli->autocommit() $mysqli->close(); - if (false !== ($tmp = @$mysqli->autocommit( false))) - printf("[030] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $mysqli->autocommit(false); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -134,4 +137,5 @@ mysqli->autocommit() require_once("clean_table.inc"); ?> --EXPECT-- +my_mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_change_user.phpt b/ext/mysqli/tests/mysqli_change_user.phpt index bf1515e645..4ad928bb0f 100644 --- a/ext/mysqli/tests/mysqli_change_user.phpt +++ b/ext/mysqli/tests/mysqli_change_user.phpt @@ -87,8 +87,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = @mysqli_change_user($link, $user, $passwd, $db))) - printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_change_user($link, $user, $passwd, $db); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[019] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", @@ -127,4 +130,5 @@ require_once('skipifconnectfailure.inc'); print "done!"; ?> --EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_character_set_name.phpt b/ext/mysqli/tests/mysqli_character_set_name.phpt index 4e7153e5b0..b50c8414b3 100644 --- a/ext/mysqli/tests/mysqli_character_set_name.phpt +++ b/ext/mysqli/tests/mysqli_character_set_name.phpt @@ -50,10 +50,13 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = @mysqli_character_set_name($link))) - printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_character_set_name($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; -?> --EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt index 4b760ec5bb..b29fb7fc2d 100644 --- a/ext/mysqli/tests/mysqli_character_set_name_oo.phpt +++ b/ext/mysqli/tests/mysqli_character_set_name_oo.phpt @@ -54,14 +54,20 @@ mysqli_chararcter_set_name(), mysql_client_encoding() [alias] $mysqli->close(); - if (false !== ($tmp = @$mysqli->character_set_name())) - printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $mysqli->character_set_name(); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - /* Make sure that the function alias exists */ - if (false !== ($tmp = @$mysqli->character_set_name())) - printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $mysqli->character_set_name(); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; -?> --EXPECT-- +my_mysqli object is already closed +my_mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt index b7f227a7c2..2d07ef155c 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_properties_no_conn.phpt @@ -16,94 +16,188 @@ require_once('skipifconnectfailure.inc'); $variables = array_keys(get_class_vars(get_class($mysqli))); sort($variables); foreach ($variables as $k => $var) { - printf("%s = '%s'\n", $var, var_export(@$mysqli->$var, true)); + try { + printf("%s = '%s'\n", $var, var_export($mysqli->$var, true)); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } } printf("\nObject variables:\n"); $variables = array_keys(get_object_vars($mysqli)); - foreach ($variables as $k => $var) { - printf("%s = '%s'\n", $var, var_export(@$mysqli->$var, true)); + foreach ($variables as $k => $var) { + try { + printf("%s = '%s'\n", $var, var_export($mysqli->$var, true)); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } } printf("\nMagic, magic properties:\n"); + try { + mysqli_affected_rows($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->affected_rows; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->client_info; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + printf("mysqli->client_version = '%s'/%s\n", $mysqli->client_version, gettype($mysqli->client_version)); + + try { + mysqli_errno($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->errno; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + mysqli_error($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->error; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + mysqli_field_count($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->field_count; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + mysqli_insert_id($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->insert_id; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + mysqli_sqlstate($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->sqlstate; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + mysqli_get_host_info($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->host_info; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + mysqli_info($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->info; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + mysqli_thread_id($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->thread_id; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + mysqli_get_proto_info($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->protocol_version; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + mysqli_get_server_info($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->server_info; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + mysqli_get_server_version($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->server_version; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + mysqli_warning_count($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $mysqli->warning_count; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - assert(@mysqli_affected_rows($mysqli) === @$mysqli->affected_rows); - printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n", - @$mysqli->affected_rows, gettype(@$mysqli->affected_rows), - @mysqli_affected_rows($mysqli), gettype(@mysqli_affected_rows($mysqli))); - - assert(@mysqli_get_client_info() === @$mysqli->client_info); - printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n", - @$mysqli->client_info, gettype(@$mysqli->client_info), - @mysqli_get_client_info(), gettype(@mysqli_get_client_info())); - - assert(@mysqli_get_client_version() === @$mysqli->client_version); - printf("mysqli->client_version = '%s'/%s ('%s'/%s)\n", - @$mysqli->client_version, gettype(@$mysqli->client_version), - @mysqli_get_client_version(), gettype(@mysqli_get_client_version())); - - assert(@mysqli_errno($mysqli) === @$mysqli->errno); - printf("mysqli->errno = '%s'/%s ('%s'/%s)\n", - @$mysqli->errno, gettype(@$mysqli->errno), - - @mysqli_errno($mysqli), gettype(@mysqli_errno($mysqli))); - - assert(@mysqli_error($mysqli) === @$mysqli->error); - printf("mysqli->error = '%s'/%s ('%s'/%s)\n", - @$mysqli->error, gettype(@$mysqli->error), - @mysqli_error($mysqli), gettype(@mysqli_error($mysqli))); - - assert(@mysqli_field_count($mysqli) === @$mysqli->field_count); - printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n", - @$mysqli->field_count, gettype(@$mysqli->field_count), - @mysqli_field_count($mysqli), gettype(@mysqli_field_count($mysqli))); - - assert(@mysqli_insert_id($mysqli) === @$mysqli->insert_id); - printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n", - @$mysqli->insert_id, gettype(@$mysqli->insert_id), - @mysqli_insert_id($mysqli), gettype(@mysqli_insert_id($mysqli))); - - assert(@mysqli_sqlstate($mysqli) === @$mysqli->sqlstate); - printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n", - @$mysqli->sqlstate, gettype(@$mysqli->sqlstate), - @mysqli_sqlstate($mysqli), gettype(@mysqli_sqlstate($mysqli))); - - assert(@mysqli_get_host_info($mysqli) === @$mysqli->host_info); - printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n", - @$mysqli->host_info, gettype(@$mysqli->host_info), - @mysqli_get_host_info($mysqli), gettype(@mysqli_get_host_info($mysqli))); - - /* note that the data types are different */ - assert(@mysqli_info($mysqli) == @$mysqli->info); - printf("mysqli->info = '%s'/%s ('%s'/%s)\n", - @$mysqli->info, gettype(@$mysqli->info), - @mysqli_info($mysqli), gettype(@mysqli_info($mysqli))); - - assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id); - assert(gettype(@$mysqli->thread_id) == gettype(@mysqli_thread_id($mysqli))); - printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n", - @$mysqli->thread_id, gettype(@$mysqli->thread_id), - @mysqli_thread_id($mysqli), gettype(@mysqli_thread_id($mysqli))); - - assert(@mysqli_get_proto_info($mysqli) === @$mysqli->protocol_version); - printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n", - @$mysqli->protocol_version, gettype(@$mysqli->protocol_version), - @mysqli_get_proto_info($mysqli), gettype(@mysqli_get_proto_info($mysqli))); - - assert(@mysqli_get_server_info($mysqli) === @$mysqli->server_info); - printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n", - @$mysqli->server_info, gettype(@$mysqli->server_info), - @mysqli_get_server_info($mysqli), gettype(@mysqli_get_server_info($mysqli))); - - assert(@mysqli_get_server_version($mysqli) === @$mysqli->server_version); - printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n", - @$mysqli->server_version, gettype(@$mysqli->server_version), - @mysqli_get_server_version($mysqli), gettype(@mysqli_get_server_version($mysqli))); - - assert(@mysqli_warning_count($mysqli) === @$mysqli->warning_count); - printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n", - @$mysqli->warning_count, gettype(@$mysqli->warning_count), - @mysqli_warning_count($mysqli), gettype(@mysqli_warning_count($mysqli))); printf("\nAccess to undefined properties:\n"); printf("mysqli->unknown = '%s'\n", @$mysqli->unknown); @@ -131,9 +225,13 @@ require_once('skipifconnectfailure.inc'); $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket); dump_properties($mysqli); - printf("With RS\n"); + printf("\nWith RS\n"); $mysqli = @new mysqli($host, $user, $passwd . "invalid", $db, $port, $socket); - $res = @$mysqli->query("SELECT * FROM test"); + try { + $mysqli->query("SELECT * FROM test"); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } dump_properties($mysqli); print "done!"; @@ -144,65 +242,74 @@ require_once('skipifconnectfailure.inc'); Without RS Class variables: -affected_rows = 'false' -client_info = 'false' +Property access is not allowed yet +Property access is not allowed yet client_version = '%s' connect_errno = '%s' connect_error = ''%s' -errno = 'false' -error = 'false' -error_list = 'false' -field_count = 'false' -host_info = 'false' -info = 'false' -insert_id = 'false' -protocol_version = 'false' -server_info = 'false' -server_version = 'false' -sqlstate = 'false' -thread_id = 'false' -warning_count = 'false' +mysqli object is already closed +mysqli object is already closed +Property access is not allowed yet +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed Object variables: -affected_rows = 'false' -client_info = 'false' +Property access is not allowed yet +Property access is not allowed yet client_version = '%s' connect_errno = '%s' -connect_error = '%s' -errno = 'false' -error = 'false' -error_list = 'false' -field_count = 'false' -host_info = 'false' -info = 'false' -insert_id = 'false' -server_info = 'false' -server_version = 'false' -sqlstate = 'false' -protocol_version = 'false' -thread_id = 'false' -warning_count = 'false' +connect_error = ''%s' +mysqli object is already closed +mysqli object is already closed +Property access is not allowed yet +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed Magic, magic properties: -mysqli->affected_rows = ''/boolean (''/boolean) - -Warning: assert(): assert(@mysqli_get_client_info() === @$mysqli->client_info) failed in %s on line %d -mysqli->client_info = ''/boolean ('%s'/%s) -mysqli->client_version = '%s'/integer ('%s'/integer) -mysqli->errno = ''/boolean (''/boolean) -mysqli->error = ''/boolean (''/boolean) -mysqli->field_count = ''/boolean (''/boolean) -mysqli->insert_id = ''/boolean (''/boolean) -mysqli->sqlstate = ''/boolean (''/boolean) -mysqli->host_info = ''/boolean (''/boolean) -mysqli->info = ''/boolean (''/boolean) - -Warning: assert(): assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id) failed in %s on line %d -mysqli->thread_id = ''/boolean (''/boolean) -mysqli->protocol_version = ''/boolean (''/boolean) -mysqli->server_info = ''/boolean (''/boolean) -mysqli->server_version = ''/boolean (''/boolean) -mysqli->warning_count = ''/boolean (''/boolean) +mysqli object is already closed +Property access is not allowed yet +Property access is not allowed yet +mysqli->client_version = '80000'/integer +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed Access to undefined properties: mysqli->unknown = '' @@ -212,68 +319,79 @@ setting mysqli->unknown, @mysqli_unknown = 'friday' Access hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation): mysqli->connect_error = '%s'/%s) mysqli->connect_errno = '%s'/integer ('%s'/integer) + With RS +mysqli object is already closed Class variables: -affected_rows = 'false' -client_info = 'false' +Property access is not allowed yet +Property access is not allowed yet client_version = '%s' connect_errno = '%s' connect_error = '%s' -errno = 'false' -error = 'false' -error_list = 'false' -field_count = 'false' -host_info = 'false' -info = 'false' -insert_id = 'false' -protocol_version = 'false' -server_info = 'false' -server_version = 'false' -sqlstate = 'false' -thread_id = 'false' -warning_count = 'false' +mysqli object is already closed +mysqli object is already closed +Property access is not allowed yet +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed Object variables: -affected_rows = 'false' -client_info = 'false' +Property access is not allowed yet +Property access is not allowed yet client_version = '%s' connect_errno = '%s' connect_error = '%s' -errno = 'false' -error = 'false' -error_list = 'false' -field_count = 'false' -host_info = 'false' -info = 'false' -insert_id = 'false' -server_info = 'false' -server_version = 'false' -sqlstate = 'false' -protocol_version = 'false' -thread_id = 'false' -warning_count = 'false' +mysqli object is already closed +mysqli object is already closed +Property access is not allowed yet +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed Magic, magic properties: -mysqli->affected_rows = ''/boolean (''/boolean) - -Warning: assert(): assert(@mysqli_get_client_info() === @$mysqli->client_info) failed in %s on line %d -mysqli->client_info = ''/boolean ('%s'/%s) -mysqli->client_version = '%s'/integer ('%s'/integer) -mysqli->errno = ''/boolean (''/boolean) -mysqli->error = ''/boolean (''/boolean) -mysqli->field_count = ''/boolean (''/boolean) -mysqli->insert_id = ''/boolean (''/boolean) -mysqli->sqlstate = ''/boolean (''/boolean) -mysqli->host_info = ''/boolean (''/boolean) -mysqli->info = ''/boolean (''/boolean) - -Warning: assert(): assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id) failed in %s on line %d -mysqli->thread_id = ''/boolean (''/boolean) -mysqli->protocol_version = ''/boolean (''/boolean) -mysqli->server_info = ''/boolean (''/boolean) -mysqli->server_version = ''/boolean (''/boolean) -mysqli->warning_count = ''/boolean (''/boolean) +mysqli object is already closed +Property access is not allowed yet +Property access is not allowed yet +mysqli->client_version = '80000'/integer +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed +mysqli object is already closed Access to undefined properties: mysqli->unknown = '' diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt index b8ab4a4af5..d16e35fb22 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_result_interface.phpt @@ -113,8 +113,11 @@ require_once('skipifconnectfailure.inc'); if (!is_object($res = new mysqli_result($link))) printf("[001] Expecting object/mysqli_result got %s/%s\n", gettye($res), $res); - if (null !== ($tmp = @$res->num_rows)) - printf("[002] Expecting NULL got %s/%s\n", gettype($tmp), $tmp); + try { + $res->num_rows; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_query($link, "SELECT id FROM test ORDER BY id")) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -177,4 +180,5 @@ Access to undefined properties: mysqli_result->unknown = '' Constructor: +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt index 3e3301361d..134529d35c 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt @@ -81,12 +81,21 @@ Interface of the class mysqli_stmt printf("\nMagic, magic properties:\n"); -assert(mysqli_stmt_affected_rows($stmt) === $stmt->affected_rows); -printf("stmt->affected_rows = '%s'\n", $stmt->affected_rows); +try { + mysqli_stmt_affected_rows($stmt); +} catch (Error $exception) { + echo $exception->getMessage() . "\n"; +} -if (!$stmt->prepare("INSERT INTO test(id, label) VALUES (100, 'z')") || -!$stmt->execute()) -printf("[001] [%d] %s\n", $stmt->errno, $stmt->error); +try { + $stmt->affected_rows; +} catch (Error $exception) { + echo $exception->getMessage() . "\n"; +} + +if (!$stmt->prepare("INSERT INTO test(id, label) VALUES (100, 'z')") || !$stmt->execute()) { + printf("[001] [%d] %s\n", $stmt->errno, $stmt->error); +} assert(mysqli_stmt_affected_rows($stmt) === $stmt->affected_rows); printf("stmt->affected_rows = '%s'\n", $stmt->affected_rows); @@ -157,14 +166,8 @@ sqlstate id Magic, magic properties: - -Warning: mysqli_stmt_affected_rows(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: main(): Property access is not allowed yet in %s on line %d - -Warning: main(): Property access is not allowed yet in %s on line %d -stmt->affected_rows = '' +mysqli_stmt object is not fully initialized +Property access is not allowed yet stmt->affected_rows = '1' stmt->errno = '0' stmt->error = '' diff --git a/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt b/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt index 3700431762..a73ef8ad68 100644 --- a/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt +++ b/ext/mysqli/tests/mysqli_class_mysqli_warning.phpt @@ -100,13 +100,9 @@ Warning: mysqli_warning::mysqli_warning() expects parameter 1 to be object, null Warning: Wrong parameter count for mysqli_warning::mysqli_warning() in %s on line %d -Warning: mysqli_warning::mysqli_warning(): Couldn't fetch mysqli in %s on line %d - -Warning: mysqli_warning::mysqli_warning(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_warning::mysqli_warning(): invalid object or resource mysqli_stmt - in %s on line %d +Warning: mysqli_warning::mysqli_warning(): mysqli object is already closed in %s on line %d +mysqli_stmt object is not fully initialized +mysqli_stmt object is not fully initialized Warning: mysqli_warning::mysqli_warning(): Invalid class argument in /home/nixnutz/php6_mysqlnd/ext/mysqli/tests/mysqli_class_mysqli_warning.php on line 19 diff --git a/ext/mysqli/tests/mysqli_close.phpt b/ext/mysqli/tests/mysqli_close.phpt index 0110847334..4532749624 100644 --- a/ext/mysqli/tests/mysqli_close.phpt +++ b/ext/mysqli/tests/mysqli_close.phpt @@ -18,10 +18,13 @@ require_once('skipifconnectfailure.inc'); if (true !== $tmp) printf("[005] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = @mysqli_query($link, "SELECT 1"))) - printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_query($link, "SELECT 1"); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; -?> --EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_close_oo.phpt b/ext/mysqli/tests/mysqli_close_oo.phpt index be189ba232..dc912925d9 100644 --- a/ext/mysqli/tests/mysqli_close_oo.phpt +++ b/ext/mysqli/tests/mysqli_close_oo.phpt @@ -21,13 +21,21 @@ require_once('skipifconnectfailure.inc'); if (true !== $tmp) printf("[003] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = @$mysqli->close())) - printf("[004] Expecting false got %s/%s\n", gettype($tmp), $tmp); + try { + $mysqli->close(); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - if (false !== ($tmp = @$mysqli->query("SELECT 1"))) - printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $mysqli->query("SELECT 1"); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> --EXPECT-- +my_mysqli object is already closed +my_mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_commit.phpt b/ext/mysqli/tests/mysqli_commit.phpt index c2b46a7294..9f1f969f4d 100644 --- a/ext/mysqli/tests/mysqli_commit.phpt +++ b/ext/mysqli/tests/mysqli_commit.phpt @@ -52,8 +52,11 @@ if (!have_innodb($link)) mysqli_close($link); - if (false !== ($tmp = @mysqli_commit($link))) - printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_commit($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -62,4 +65,5 @@ if (!have_innodb($link)) require_once("clean_table.inc"); ?> --EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_commit_oo.phpt b/ext/mysqli/tests/mysqli_commit_oo.phpt index 46069fd425..205fbc48ab 100644 --- a/ext/mysqli/tests/mysqli_commit_oo.phpt +++ b/ext/mysqli/tests/mysqli_commit_oo.phpt @@ -21,9 +21,11 @@ if (!have_innodb($link)) $link = NULL; $mysqli = new mysqli(); - if (false !== ($tmp = @$mysqli->commit())) { - printf("[013] Expecting false got %s/%s\n", gettype($tmp), $tmp); - } + try { + $mysqli->commit(); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) { printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", @@ -90,20 +92,24 @@ if (!have_innodb($link)) $mysqli->close(); - if (false !== ($tmp = @$mysqli->commit())) { - printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp); - } + try { + $mysqli->commit(); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; -?> --CLEAN-- <?php require_once("clean_table.inc"); ?> --EXPECTF-- +mysqli object is not fully initialized + Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d +my_mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_connect_oo.phpt b/ext/mysqli/tests/mysqli_connect_oo.phpt index 15520d42b5..4a675b587c 100644 --- a/ext/mysqli/tests/mysqli_connect_oo.phpt +++ b/ext/mysqli/tests/mysqli_connect_oo.phpt @@ -56,13 +56,14 @@ require_once('skipifconnectfailure.inc'); printf("[012] Failed to create mysqli object\n"); } else { // There shall be NO connection! Using new mysqli(void) shall not use defaults for a connection! - // We had long discussions on this and found that the ext/mysqli API as - // such is broken. As we can't fix it, we document how it has behaved from - // the first day on. And that's: no connection. - if (false !== ($tmp = @$mysqli->query('SELECT 1'))) { - printf("[013] There shall be no connection!\n"); - $mysqli->close(); - } + // We had long discussions on this and found that the ext/mysqli API as + // such is broken. As we can't fix it, we document how it has behaved from + // the first day on. And that's: no connection. + try { + $mysqli->query('SELECT 1'); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } } if ($IS_MYSQLND) { @@ -75,9 +76,10 @@ require_once('skipifconnectfailure.inc'); // We had long discussions on this and found that the ext/mysqli API as // such is broken. As we can't fix it, we document how it has behaved from // the first day on. And that's: no connection. - if (false !== ($tmp = @$mysqli->query('SELECT 1'))) { - printf("[011] There shall be no connection!\n"); - $mysqli->close(); + try { + $mysqli->query('SELECT 1'); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; } } } @@ -148,6 +150,8 @@ require_once('skipifconnectfailure.inc'); ?> --EXPECTF-- Warning: mysqli::__construct(): (%s/%d): Access denied for user '%sunknown%s'@'%s' (using password: %s) in %s on line %d +mysqli object is not fully initialized +mysqli object is not fully initialized ... and now Exceptions Access denied for user '%s'@'%s' (using password: %s) done! diff --git a/ext/mysqli/tests/mysqli_data_seek.phpt b/ext/mysqli/tests/mysqli_data_seek.phpt index 0859ee61d5..b97cf717fa 100644 --- a/ext/mysqli/tests/mysqli_data_seek.phpt +++ b/ext/mysqli/tests/mysqli_data_seek.phpt @@ -44,8 +44,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); - if (false !== ($tmp = mysqli_data_seek($res, 1))) - printf("[013] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_data_seek($res, 1); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); @@ -57,6 +60,5 @@ require_once('skipifconnectfailure.inc'); ?> --EXPECTF-- Warning: mysqli_data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d - -Warning: mysqli_data_seek(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_data_seek_oo.phpt b/ext/mysqli/tests/mysqli_data_seek_oo.phpt index 2c4377d845..0a2717b160 100644 --- a/ext/mysqli/tests/mysqli_data_seek_oo.phpt +++ b/ext/mysqli/tests/mysqli_data_seek_oo.phpt @@ -16,8 +16,12 @@ require_once('skipifconnectfailure.inc'); $host, $user, $db, $port, $socket); $res = new mysqli_result($mysqli); - if (false !== ($tmp = @$res->data_seek(0))) - printf("[002] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + + try { + $res->data_seek(0); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!$res = $mysqli->query('SELECT * FROM test ORDER BY id LIMIT 4', MYSQLI_STORE_RESULT)) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -52,19 +56,22 @@ require_once('skipifconnectfailure.inc'); $res->free_result(); - if (false !== ($tmp = $res->data_seek(1))) - printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $res->data_seek(1); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } $mysqli->close(); print "done!"; -?> --CLEAN-- <?php require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_result::data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d +mysqli_result object is already closed -Warning: mysqli_result::data_seek(): Couldn't fetch mysqli_result in %s on line %d +Warning: mysqli_result::data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt b/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt index 268bd619cb..391940b12e 100644 --- a/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt +++ b/ext/mysqli/tests/mysqli_disable_reads_from_master.phpt @@ -43,5 +43,5 @@ if (!function_exists('mysqli_disable_reads_from_master')) { require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_disable_reads_from_master(): Couldn't fetch mysqli in %s on line %d +Warning: mysqli_disable_reads_from_master(): mysqli object is already closed in %s on line %d done! diff --git a/ext/mysqli/tests/mysqli_dump_debug_info.phpt b/ext/mysqli/tests/mysqli_dump_debug_info.phpt index d9c894dfff..d7ef81b822 100644 --- a/ext/mysqli/tests/mysqli_dump_debug_info.phpt +++ b/ext/mysqli/tests/mysqli_dump_debug_info.phpt @@ -23,13 +23,13 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_dump_debug_info($link))) - printf("[005] Expecting NULL, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, - mysqli_errno($link), mysqli_error($link)); + try { + mysqli_dump_debug_info($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; -?> ---EXPECTF-- -Warning: mysqli_dump_debug_info(): Couldn't fetch mysqli in %s on line %d +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt index 58eb63cb2b..8fb07617b7 100644 --- a/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt +++ b/ext/mysqli/tests/mysqli_dump_debug_info_oo.phpt @@ -23,13 +23,14 @@ require_once('skipifconnectfailure.inc'); $mysqli->close(); - if (false !== ($tmp = $mysqli->dump_debug_info())) - printf("[004] Expecting false, got %s/%s, [%d] %s\n", - gettype($tmp), $tmp, - $mysqli->errno, $mysqli->error); + try { + $mysqli->dump_debug_info(); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> ---EXPECTF-- -Warning: mysqli::dump_debug_info(): Couldn't fetch mysqli in %s on line %d +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt b/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt index 17b4b37529..3399f843b1 100644 --- a/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt +++ b/ext/mysqli/tests/mysqli_enable_reads_from_master.phpt @@ -31,7 +31,11 @@ if (!function_exists('mysqli_enable_reads_from_master')) { if (!is_bool($tmp = mysqli_enable_reads_from_master($link))) printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp); - mysqli_close($link); + try { + mysqli_close($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (NULL !== ($tmp = mysqli_enable_reads_from_master($link))) printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); @@ -39,5 +43,5 @@ if (!function_exists('mysqli_enable_reads_from_master')) { print "done!"; ?> --EXPECTF-- -Warning: mysqli_enable_reads_from_master(): Couldn't fetch mysqli in %s on line %d +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_errno.phpt b/ext/mysqli/tests/mysqli_errno.phpt index f26a30e089..04ab8a4a41 100644 --- a/ext/mysqli/tests/mysqli_errno.phpt +++ b/ext/mysqli/tests/mysqli_errno.phpt @@ -30,14 +30,16 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - var_dump(mysqli_errno($link)); + try { + mysqli_errno($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> --EXPECTF-- int(0) int(%d) - -Warning: mysqli_errno(): Couldn't fetch mysqli in %s on line %d -bool(false) +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_errno_oo.phpt b/ext/mysqli/tests/mysqli_errno_oo.phpt index f2fa2529a1..b548575d6d 100644 --- a/ext/mysqli/tests/mysqli_errno_oo.phpt +++ b/ext/mysqli/tests/mysqli_errno_oo.phpt @@ -36,14 +36,16 @@ require_once('skipifconnectfailure.inc'); $mysqli->close(); - var_dump($mysqli->errno); + try { + $mysqli->errno; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> --EXPECTF-- int(0) int(%d) - -Warning: main(): Couldn't fetch mysqli in %s on line %d -bool(false) +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_error.phpt b/ext/mysqli/tests/mysqli_error.phpt index 4154f45f1d..b7f034f267 100644 --- a/ext/mysqli/tests/mysqli_error.phpt +++ b/ext/mysqli/tests/mysqli_error.phpt @@ -30,11 +30,14 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - var_dump(mysqli_error($link)); + try { + mysqli_error($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> ---EXPECTF-- -Warning: mysqli_error(): Couldn't fetch mysqli in %s on line %d -bool(false) +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_error_oo.phpt b/ext/mysqli/tests/mysqli_error_oo.phpt index d05fd6f383..3f3c673415 100644 --- a/ext/mysqli/tests/mysqli_error_oo.phpt +++ b/ext/mysqli/tests/mysqli_error_oo.phpt @@ -36,11 +36,14 @@ require_once('skipifconnectfailure.inc'); $mysqli->close(); - var_dump($mysqli->error); + try { + $mysqli->error; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> ---EXPECTF-- -Warning: main(): Couldn't fetch mysqli in %s on line %d -bool(false) +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_error_unicode.phpt b/ext/mysqli/tests/mysqli_error_unicode.phpt index 8127931882..ce70c901e1 100644 --- a/ext/mysqli/tests/mysqli_error_unicode.phpt +++ b/ext/mysqli/tests/mysqli_error_unicode.phpt @@ -28,13 +28,14 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - var_dump(mysqli_error($link)); + try { + mysqli_error($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; -?> --EXPECTF-- string(%d) "Table 'няма_такава_таблица' doesn't exist" - -Warning: mysqli_error(): Couldn't fetch mysqli in %s on line %d -bool(false) +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_all.phpt b/ext/mysqli/tests/mysqli_fetch_all.phpt index 9f18499454..7b8f50a57e 100644 --- a/ext/mysqli/tests/mysqli_fetch_all.phpt +++ b/ext/mysqli/tests/mysqli_fetch_all.phpt @@ -75,11 +75,8 @@ if (!function_exists('mysqli_fetch_all')) $illegal_mode = mt_rand(-10000, 10000); } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH))); // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes. - $tmp = mysqli_fetch_all($res, $illegal_mode); - if (false !== $tmp) - printf("[019] Expecting boolean/false although, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + mysqli_fetch_all($res, $illegal_mode); mysqli_free_result($res); function func_mysqli_fetch_all($link, $engine, $sql_type, $sql_value, $php_value, $offset, $regexp_comparison = NULL) { @@ -287,8 +284,11 @@ if (!function_exists('mysqli_fetch_all')) mysqli_close($link); - if (false !== ($tmp = mysqli_fetch_array($res, MYSQLI_ASSOC))) - printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_fetch_array($res, MYSQLI_ASSOC); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { printf("[016] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", @@ -309,7 +309,6 @@ if (!function_exists('mysqli_fetch_all')) var_dump($rows); } - print "done!"; ?> --CLEAN-- @@ -446,6 +445,5 @@ array(1) { } Warning: mysqli_fetch_all(): Mode can be only MYSQLI_FETCH_NUM, MYSQLI_FETCH_ASSOC or MYSQLI_FETCH_BOTH in %s on line %d - -Warning: mysqli_fetch_array(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt index 9dac357ae1..63c32e32d4 100644 --- a/ext/mysqli/tests/mysqli_fetch_all_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_all_oo.phpt @@ -298,8 +298,11 @@ if (!function_exists('mysqli_fetch_all')) mysqli_close($link); - if (false !== ($tmp = $res->fetch_array(MYSQLI_ASSOC))) - printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $res->fetch_array(MYSQLI_ASSOC); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -435,6 +438,5 @@ array(1) { } Warning: mysqli_result::fetch_all(): Mode can be only MYSQLI_FETCH_NUM, MYSQLI_FETCH_ASSOC or MYSQLI_FETCH_BOTH in %s on line %d - -Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_array.phpt b/ext/mysqli/tests/mysqli_fetch_array.phpt index 775c6f20c4..5e423aa2b9 100644 --- a/ext/mysqli/tests/mysqli_fetch_array.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array.phpt @@ -279,8 +279,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_fetch_array($res, MYSQLI_ASSOC))) - printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_fetch_array($res, MYSQLI_ASSOC); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -361,6 +364,5 @@ array(11) { Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d - -Warning: mysqli_fetch_array(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt index b0e2234960..b3e8dda9c4 100644 --- a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt @@ -271,8 +271,11 @@ require_once('skipifconnectfailure.inc'); $mysqli->close(); - if (false !== ($tmp = $res->fetch_array(MYSQLI_ASSOC))) - printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $res->fetch_array(MYSQLI_ASSOC); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -357,6 +360,5 @@ array(11) { Warning: mysqli_result::fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d Warning: mysqli_result::fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d - -Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_assoc.phpt b/ext/mysqli/tests/mysqli_fetch_assoc.phpt index 3097eb2bc4..8bc26fcdbd 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc.phpt @@ -51,8 +51,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); - if (false !== ($tmp = mysqli_fetch_assoc($res))) - printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_fetch_assoc($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); @@ -62,7 +65,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- +--EXPECT-- [005] array(2) { ["id"]=> @@ -105,6 +108,5 @@ array(15) { ["-02"]=> string(1) "f" } - -Warning: mysqli_fetch_assoc(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt index db3457a4a0..c1eef6eaf5 100644 --- a/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt @@ -15,9 +15,11 @@ require_once('skipifconnectfailure.inc'); // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test $mysqli = new mysqli(); - $res = @new mysqli_result($mysqli); - if (false !== ($tmp = @$res->fetch_assoc())) - printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + new mysqli_result($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } require('table.inc'); if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) @@ -44,8 +46,11 @@ require_once('skipifconnectfailure.inc'); $res->free_result(); - if (false !== ($tmp = $res->fetch_assoc())) - printf("[008] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $res->fetch_assoc(); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); @@ -55,7 +60,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- +--EXPECT-- +mysqli object is not fully initialized [005] array(2) { ["id"]=> @@ -78,6 +84,5 @@ array(5) { ["e"]=> string(1) "1" } - -Warning: mysqli_result::fetch_assoc(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_field.phpt b/ext/mysqli/tests/mysqli_fetch_field.phpt index 5035cf70d2..7cd3208bc5 100644 --- a/ext/mysqli/tests/mysqli_fetch_field.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field.phpt @@ -50,8 +50,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); // Read http://bugs.php.net/bug.php?id=42344 on defaults! - if (false !== ($tmp = mysqli_fetch_field($res))) - printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_fetch_field($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -136,8 +139,7 @@ object(stdClass)#%d (13) { int(0) } bool(false) - -Warning: mysqli_fetch_field(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed array(1) { ["_default_test"]=> string(1) "2" diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt index 5acc3b75d4..5bf15a951e 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_direct.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_direct.phpt @@ -22,8 +22,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); - if (false !== ($tmp = mysqli_fetch_field_direct($res, 0))) - printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_fetch_field_direct($res, 0); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -66,6 +69,5 @@ object(stdClass)#%d (13) { Warning: mysqli_fetch_field_direct(): Field offset is invalid for resultset in %s on line %d bool(false) - -Warning: mysqli_fetch_field_direct(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt index c1220c7832..ea4ef9587a 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt @@ -11,7 +11,11 @@ require_once('skipifconnectfailure.inc'); require_once("connect.inc"); $mysqli = new mysqli(); - $res = @new mysqli_result($mysqli); + try { + new mysqli_result($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } require('table.inc'); @@ -29,8 +33,11 @@ require_once('skipifconnectfailure.inc'); $res->free_result(); - if (false !== ($tmp = $res->fetch_field_direct(0))) - printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $res->fetch_field_direct(0); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } $mysqli->close(); print "done!"; @@ -40,6 +47,8 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- +mysqli object is not fully initialized + Warning: mysqli_result::fetch_field_direct(): Field offset is invalid for resultset in %s on line %d bool(false) object(stdClass)#%d (13) { @@ -73,6 +82,5 @@ object(stdClass)#%d (13) { Warning: mysqli_result::fetch_field_direct(): Field offset is invalid for resultset in %s on line %d bool(false) - -Warning: mysqli_result::fetch_field_direct(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt index 35fdbb050e..12400a730d 100644 --- a/ext/mysqli/tests/mysqli_fetch_field_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_field_oo.phpt @@ -12,7 +12,12 @@ require_once('skipifconnectfailure.inc'); // Note: no SQL type tests, internally the same function gets used as for mysqli_fetch_array() which does a lot of SQL type test $mysqli = new mysqli(); - $res = @new mysqli_result($mysqli); + $res = false; + try { + new mysqli_result($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } require('table.inc'); if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) @@ -51,8 +56,11 @@ require_once('skipifconnectfailure.inc'); $res->free_result(); - if (false !== ($tmp = $res->fetch_field())) - printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + $res->fetch_field(); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } $mysqli->close(); print "done!"; @@ -62,6 +70,7 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- +mysqli object is not fully initialized object(stdClass)#%d (13) { ["name"]=> string(2) "ID" @@ -119,6 +128,5 @@ object(stdClass)#%d (13) { int(0) } bool(false) - -Warning: mysqli_result::fetch_field(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_fields.phpt b/ext/mysqli/tests/mysqli_fetch_fields.phpt index 6dee8108f9..3c4eb086b2 100644 --- a/ext/mysqli/tests/mysqli_fetch_fields.phpt +++ b/ext/mysqli/tests/mysqli_fetch_fields.phpt @@ -47,8 +47,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); - if (false !== ($tmp = mysqli_fetch_fields($res))) - printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_fetch_fields($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -114,6 +117,5 @@ object(stdClass)#%d (13) { ["decimals"]=> int(0) } - -Warning: mysqli_fetch_fields(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_lengths.phpt b/ext/mysqli/tests/mysqli_fetch_lengths.phpt index b407d91894..1e4bf453e6 100644 --- a/ext/mysqli/tests/mysqli_fetch_lengths.phpt +++ b/ext/mysqli/tests/mysqli_fetch_lengths.phpt @@ -27,7 +27,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); - var_dump(mysqli_fetch_lengths($res)); + try { + mysqli_fetch_lengths($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -36,7 +40,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- +--EXPECT-- bool(false) array(2) { [0]=> @@ -45,7 +49,5 @@ array(2) { int(1) } bool(false) - -Warning: mysqli_fetch_lengths(): Couldn't fetch mysqli_result in %s on line %d -bool(false) +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt b/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt index c352bea8a0..2e8e2722ee 100644 --- a/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt @@ -24,7 +24,11 @@ require_once('skipifconnectfailure.inc'); var_dump($res->lengths); $res->free_result(); - var_dump($res->lengths); + try { + $res->lengths; + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } $mysqli->close(); print "done!"; ?> @@ -35,7 +39,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- +--EXPECT-- NULL array(2) { [0]=> @@ -44,7 +48,5 @@ array(2) { int(1) } NULL - -Warning: main(): Property access is not allowed yet in %s on line %d -bool(false) +Property access is not allowed yet done! diff --git a/ext/mysqli/tests/mysqli_fetch_object.phpt b/ext/mysqli/tests/mysqli_fetch_object.phpt index 3230162ce7..9042815dfd 100644 --- a/ext/mysqli/tests/mysqli_fetch_object.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object.phpt @@ -86,7 +86,11 @@ require_once('skipifconnectfailure.inc'); } mysqli_free_result($res); - var_dump(mysqli_fetch_object($res)); + try { + mysqli_fetch_object($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -140,8 +144,7 @@ Exception: Too few arguments to function mysqli_fetch_object_construct::__constr 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 -bool(false) +mysqli_result object is already closed [0] mysqli_fetch_object() expects parameter 3 to be array, string given in %s on line %d Fatal error: Class 'this_class_does_not_exist' not found 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 a81cb7f80a..54845843cf 100644 --- a/ext/mysqli/tests/mysqli_fetch_object_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_object_oo.phpt @@ -12,9 +12,11 @@ require_once('skipifconnectfailure.inc'); set_error_handler('handle_catchable_fatal'); $mysqli = new mysqli(); - $res = @new mysqli_result($mysqli); - if (false !== ($tmp = @$res->fetch_object())) - printf("[001] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + new mysqli_result($mysqli); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } require('table.inc'); if (!$mysqli = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) @@ -110,7 +112,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); - var_dump(mysqli_fetch_object($res)); + try { + mysqli_fetch_object($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } // Fatal error, script execution will end var_dump($res->fetch_object('this_class_does_not_exist')); @@ -123,16 +129,13 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -[E_WARNING] mysqli_result::__construct(): invalid object or resource mysqli - in %s on line %d -[E_WARNING] mysqli_result::fetch_object(): Couldn't fetch mysqli_result in %s on line %d +mysqli object is not fully initialized [0] mysqli_result::fetch_object() expects parameter 1 to be string, object given in %s on line %d [0] mysqli_result::fetch_object() expects at most 2 parameters, 3 given in %s on line %d [0] mysqli_result::fetch_object() expects parameter 2 to be array, null given 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 -bool(false) +mysqli_result object is already closed Fatal error: Class 'this_class_does_not_exist' not found in %s on line %d diff --git a/ext/mysqli/tests/mysqli_fetch_row.phpt b/ext/mysqli/tests/mysqli_fetch_row.phpt index c16ca1da77..d2ddea6c1a 100644 --- a/ext/mysqli/tests/mysqli_fetch_row.phpt +++ b/ext/mysqli/tests/mysqli_fetch_row.phpt @@ -23,7 +23,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); - var_dump(mysqli_fetch_row($res)); + try { + mysqli_fetch_row($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -32,7 +36,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- +--EXPECT-- [004] array(3) { [0]=> @@ -44,7 +48,5 @@ array(3) { } [005] NULL - -Warning: mysqli_fetch_row(): Couldn't fetch mysqli_result in %s on line %d -bool(false) +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_field_count.phpt b/ext/mysqli/tests/mysqli_field_count.phpt index 18fc3c9ec1..d6a7be5fcc 100644 --- a/ext/mysqli/tests/mysqli_field_count.phpt +++ b/ext/mysqli/tests/mysqli_field_count.phpt @@ -34,21 +34,22 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - var_dump(mysqli_field_count($link)); + try { + mysqli_field_count($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; -?> --CLEAN-- <?php require_once("clean_table.inc"); ?> ---EXPECTF-- +--EXPECT-- int(0) int(2) int(0) int(0) int(3) - -Warning: mysqli_field_count(): Couldn't fetch mysqli in %s on line %d -bool(false) +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_field_seek.phpt b/ext/mysqli/tests/mysqli_field_seek.phpt index 3cd60c7ce9..91c4360483 100644 --- a/ext/mysqli/tests/mysqli_field_seek.phpt +++ b/ext/mysqli/tests/mysqli_field_seek.phpt @@ -101,7 +101,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); - var_dump(mysqli_field_seek($res, 0)); + try { + mysqli_field_seek($res, 0); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -233,7 +237,5 @@ object(stdClass)#%d (13) { ["decimals"]=> int(0) } - -Warning: mysqli_field_seek(): Couldn't fetch mysqli_result in %s on line %d -bool(false) +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_field_tell.phpt b/ext/mysqli/tests/mysqli_field_tell.phpt index 0b1d3bd0c1..a39e1ff814 100644 --- a/ext/mysqli/tests/mysqli_field_tell.phpt +++ b/ext/mysqli/tests/mysqli_field_tell.phpt @@ -34,7 +34,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); - var_dump(mysqli_field_tell($res)); + try { + mysqli_field_tell($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); @@ -87,7 +91,5 @@ bool(false) int(1) bool(true) int(0) - -Warning: mysqli_field_tell(): Couldn't fetch mysqli_result in %s on line %d -bool(false) +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_free_result.phpt b/ext/mysqli/tests/mysqli_free_result.phpt index be377a8817..c64ec918cc 100644 --- a/ext/mysqli/tests/mysqli_free_result.phpt +++ b/ext/mysqli/tests/mysqli_free_result.phpt @@ -16,18 +16,25 @@ require_once('skipifconnectfailure.inc'); } print "a\n"; - var_dump(mysqli_free_result($res)); + var_dump(mysqli_free_result($res)); + print "b\n"; - var_dump(mysqli_free_result($res)); + try { + mysqli_free_result($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { + printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); + } - if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { - printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - } print "c\n"; var_dump(mysqli_store_result($link)); var_dump(mysqli_error($link)); print "[005]\n"; - var_dump(mysqli_free_result($res)); + + mysqli_free_result($res); if (!$res = mysqli_query($link, "SELECT id FROM test ORDER BY id LIMIT 1")) { printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -49,14 +56,11 @@ require_once('skipifconnectfailure.inc'); a NULL b - -Warning: mysqli_free_result(): Couldn't fetch mysqli_result in %s on line %d -bool(false) +mysqli_result object is already closed c bool(false) string(0) "" [005] -NULL d bool(false) string(0) "" diff --git a/ext/mysqli/tests/mysqli_get_charset.phpt b/ext/mysqli/tests/mysqli_get_charset.phpt index cd7cfb3ae4..80d0300c2b 100644 --- a/ext/mysqli/tests/mysqli_get_charset.phpt +++ b/ext/mysqli/tests/mysqli_get_charset.phpt @@ -89,8 +89,11 @@ if (!function_exists('mysqli_get_charset')) mysqli_close($link); - if (false !== ($tmp = mysqli_get_charset($link))) - printf("[023] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_get_charset($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -98,6 +101,6 @@ if (!function_exists('mysqli_get_charset')) <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_get_charset(): Couldn't fetch mysqli in %s on line %d +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_insert_id.phpt b/ext/mysqli/tests/mysqli_insert_id.phpt index 383ed087b7..ba93ba41ca 100644 --- a/ext/mysqli/tests/mysqli_insert_id.phpt +++ b/ext/mysqli/tests/mysqli_insert_id.phpt @@ -117,7 +117,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - var_dump(mysqli_insert_id($link)); + try { + mysqli_insert_id($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -125,7 +129,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_insert_id(): Couldn't fetch mysqli in %s on line %d -bool(false) +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_more_results.phpt b/ext/mysqli/tests/mysqli_more_results.phpt index b9a971c24e..5a967c0776 100644 --- a/ext/mysqli/tests/mysqli_more_results.phpt +++ b/ext/mysqli/tests/mysqli_more_results.phpt @@ -50,7 +50,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - var_dump(mysqli_more_results($link)); + try { + mysqli_more_results($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -67,7 +71,5 @@ bool(false) [010] 1 2 - -Warning: mysqli_more_results(): Couldn't fetch mysqli in %s on line %d -bool(false) +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_multi_query.phpt b/ext/mysqli/tests/mysqli_multi_query.phpt index 57235c2b17..10f1a62202 100644 --- a/ext/mysqli/tests/mysqli_multi_query.phpt +++ b/ext/mysqli/tests/mysqli_multi_query.phpt @@ -102,7 +102,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - var_dump(mysqli_multi_query($link, "SELECT id, label FROM test")); + try { + mysqli_multi_query($link, "SELECT id, label FROM test"); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -115,7 +119,5 @@ require_once('skipifconnectfailure.inc'); [008] 0 [009] [2014] Commands out of sync; you can't run this command now [010] 7 - -Warning: mysqli_multi_query(): Couldn't fetch mysqli in %s on line %d -bool(false) +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_next_result.phpt b/ext/mysqli/tests/mysqli_next_result.phpt index b37d9949fa..36ab5959dc 100644 --- a/ext/mysqli/tests/mysqli_next_result.phpt +++ b/ext/mysqli/tests/mysqli_next_result.phpt @@ -55,7 +55,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - var_dump(mysqli_next_result($link)); + try { + mysqli_next_result($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -64,7 +68,5 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- - -Warning: mysqli_next_result(): Couldn't fetch mysqli in %s on line %d -bool(false) +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_num_fields.phpt b/ext/mysqli/tests/mysqli_num_fields.phpt index 1f33b4d2d9..610d311db6 100644 --- a/ext/mysqli/tests/mysqli_num_fields.phpt +++ b/ext/mysqli/tests/mysqli_num_fields.phpt @@ -26,8 +26,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); - if ($test_free && (false !== ($tmp = mysqli_num_fields($res)))) - printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp); + try { + mysqli_num_fields($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } } func_test_mysqli_num_fields($link, "SELECT 1 AS a", 1, 5); @@ -43,6 +46,9 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_num_fields(): Couldn't fetch mysqli_result in %s on line %d +--EXPECT-- +mysqli_result object is already closed +mysqli_result object is already closed +mysqli_result object is already closed +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_num_rows.phpt b/ext/mysqli/tests/mysqli_num_rows.phpt index 15d3f90257..f378bdd57e 100644 --- a/ext/mysqli/tests/mysqli_num_rows.phpt +++ b/ext/mysqli/tests/mysqli_num_rows.phpt @@ -27,8 +27,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); - if ($test_free && (false !== ($tmp = mysqli_num_rows($res)))) - printf("[%03d] Expecting false, got %s/%s\n", $offset + 2, gettype($tmp), $tmp); + try { + mysqli_num_rows($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } } } @@ -57,7 +60,6 @@ require_once('skipifconnectfailure.inc'); printf("[031] Expecting int/0, got %s/%d\n", gettype($tmp), $tmp); mysqli_free_result($res); - } else { printf("[032] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); } @@ -70,7 +72,10 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_num_rows(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed +mysqli_result object is already closed +mysqli_result object is already closed +mysqli_result object is already closed run_tests.php don't fool me with your 'ungreedy' expression '.+?'! Warning: mysqli_num_rows(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d diff --git a/ext/mysqli/tests/mysqli_options.phpt b/ext/mysqli/tests/mysqli_options.phpt index 7b920b4f4c..9894cf5a29 100644 --- a/ext/mysqli/tests/mysqli_options.phpt +++ b/ext/mysqli/tests/mysqli_options.phpt @@ -88,8 +88,13 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - echo "Link closed"; - var_dump("MYSQLI_INIT_COMMAND", mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1')); + echo "Link closed\n"; + try { + mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1'); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + print "done!"; ?> --EXPECTF-- @@ -118,7 +123,5 @@ bool(true) %s(17) "MYSQLI_CLIENT_SSL" bool(false) Link closed -Warning: mysqli_options(): Couldn't fetch mysqli in %s line %d -%s(19) "MYSQLI_INIT_COMMAND" -bool(false) +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_pconn_kill.phpt b/ext/mysqli/tests/mysqli_pconn_kill.phpt index f4be4c7c7b..d6fba4d8e3 100644 --- a/ext/mysqli/tests/mysqli_pconn_kill.phpt +++ b/ext/mysqli/tests/mysqli_pconn_kill.phpt @@ -62,7 +62,11 @@ mysqli.max_persistent=2 printf("[009] Thread of the regular connection should be still there, [%d] %s\n", mysqli_errno($link), mysqli_error($link)); // On PHP side this should do nothing. PHP should not try to close the connection or something. - @mysqli_close($plink); + try { + mysqli_close($plink); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!$plink = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) printf("[011] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", @@ -92,4 +96,5 @@ mysqli.max_persistent=2 require_once("clean_table.inc"); ?> --EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_ping.phpt b/ext/mysqli/tests/mysqli_ping.phpt index 93deeebfa3..aec065c3de 100644 --- a/ext/mysqli/tests/mysqli_ping.phpt +++ b/ext/mysqli/tests/mysqli_ping.phpt @@ -25,14 +25,16 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_ping($link))) - printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_ping($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> ---EXPECTF-- +--EXPECT-- bool(true) bool(true) - -Warning: mysqli_ping(): Couldn't fetch mysqli in %s on line %d +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_query.phpt b/ext/mysqli/tests/mysqli_query.phpt index a9502a83e4..be2f6f75a3 100644 --- a/ext/mysqli/tests/mysqli_query.phpt +++ b/ext/mysqli/tests/mysqli_query.phpt @@ -90,8 +90,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_query($link, "SELECT id FROM test"))) - printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_query($link, "SELECT id FROM test"); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -109,7 +112,7 @@ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) mysqli_close($link); ?> ---EXPECTF-- +--EXPECT-- array(1) { ["valid"]=> string(30) "this is sql but with semicolon" @@ -119,6 +122,5 @@ array(1) { string(1) "a" } string(1) "a" - -Warning: mysqli_query(): Couldn't fetch mysqli in %s on line %d +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_query_iterators.phpt b/ext/mysqli/tests/mysqli_query_iterators.phpt index 81ca8c0fae..e653291a1b 100644 --- a/ext/mysqli/tests/mysqli_query_iterators.phpt +++ b/ext/mysqli/tests/mysqli_query_iterators.phpt @@ -23,13 +23,18 @@ require_once('skipifconnectfailure.inc'); var_dump($row); } echo "======\n"; + foreach ($res as $row) { var_dump($row); } mysqli_free_result($res); - foreach ($res as $row) { - var_dump($row); - } + try { + foreach ($res as $row) { + $row; + } + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } } echo "--- Testing USE_RESULT ---\n"; if (!is_object($res = mysqli_query($link, "SELECT id FROM test ORDER BY id", MYSQLI_USE_RESULT))) @@ -118,8 +123,7 @@ array(1) { ["id"]=> string(1) "6" } - -Warning: main(): Couldn't fetch mysqli_result in %s on line %d +mysqli_result object is already closed --- Testing USE_RESULT --- array(1) { ["id"]=> diff --git a/ext/mysqli/tests/mysqli_query_unicode.phpt b/ext/mysqli/tests/mysqli_query_unicode.phpt index f167b4373a..53fba7e5a9 100644 --- a/ext/mysqli/tests/mysqli_query_unicode.phpt +++ b/ext/mysqli/tests/mysqli_query_unicode.phpt @@ -75,8 +75,11 @@ mysqli_close($link); mysqli_close($link); - if (false !== ($tmp = mysqli_query($link, "SELECT id FROM test"))) - printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_query($link, "SELECT id FROM test"); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -85,6 +88,5 @@ array(1) { ["правилен"]=> string(%d) "това ескюел, но с точка и запетая" } - -Warning: mysqli_query(): Couldn't fetch mysqli in %s on line %d +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_real_connect.phpt b/ext/mysqli/tests/mysqli_real_connect.phpt index b8ecde90ab..6844db4f1f 100644 --- a/ext/mysqli/tests/mysqli_real_connect.phpt +++ b/ext/mysqli/tests/mysqli_real_connect.phpt @@ -140,8 +140,11 @@ mysqli.allow_local_infile=1 @mysqli_close($link); } - if (false !== ($tmp = mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))) - printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -159,6 +162,5 @@ object(mysqli)#%d (%d) { ["connect_error"]=> NULL } - -Warning: mysqli_real_connect(): Couldn't fetch mysqli in %s on line %d +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_real_escape_string.phpt b/ext/mysqli/tests/mysqli_real_escape_string.phpt index 57ab99eb89..9658bfc52d 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string.phpt @@ -32,11 +32,14 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_real_escape_string($link, 'foo'))) - printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_real_escape_string($link, 'foo'); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> ---EXPECTF-- -Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in %s on line %d +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt index 3db0ecce62..d27c09359c 100644 --- a/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt +++ b/ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt @@ -62,8 +62,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_real_escape_string($link, 'foo'))) - printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_real_escape_string($link, 'foo'); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -71,6 +74,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in %s on line %d +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_real_query.phpt b/ext/mysqli/tests/mysqli_real_query.phpt index 4515810310..5528ca63aa 100644 --- a/ext/mysqli/tests/mysqli_real_query.phpt +++ b/ext/mysqli/tests/mysqli_real_query.phpt @@ -72,8 +72,11 @@ ver_param;')) { mysqli_close($link); - if (false !== ($tmp = mysqli_real_query($link, "SELECT id FROM test"))) - printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_real_query($link, "SELECT id FROM test"); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -91,11 +94,10 @@ if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) mysqli_close($link); ?> ---EXPECTF-- +--EXPECT-- array(1) { ["valid"]=> string(30) "this is sql but with semicolon" } - -Warning: mysqli_real_query(): Couldn't fetch mysqli in %s on line %d +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_result_references.phpt b/ext/mysqli/tests/mysqli_result_references.phpt index d4fe48816a..738c2b2735 100644 --- a/ext/mysqli/tests/mysqli_result_references.phpt +++ b/ext/mysqli/tests/mysqli_result_references.phpt @@ -59,6 +59,7 @@ require_once('skipifconnectfailure.inc'); $references[$idx++] = &$res; mysqli_free_result($res); + debug_zval_dump($references); if (!(mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 1")) || diff --git a/ext/mysqli/tests/mysqli_rollback.phpt b/ext/mysqli/tests/mysqli_rollback.phpt index e46ffbc296..be5ac7870a 100644 --- a/ext/mysqli/tests/mysqli_rollback.phpt +++ b/ext/mysqli/tests/mysqli_rollback.phpt @@ -49,8 +49,11 @@ mysqli_rollback() mysqli_close($link); - if (false !== ($tmp = mysqli_rollback($link))) - printf("[014] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_rollback($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!\n"; ?> @@ -58,6 +61,6 @@ mysqli_rollback() <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_rollback(): Couldn't fetch mysqli in %s on line %d +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_select_db.phpt b/ext/mysqli/tests/mysqli_select_db.phpt index e023866c17..a3d165bd02 100644 --- a/ext/mysqli/tests/mysqli_select_db.phpt +++ b/ext/mysqli/tests/mysqli_select_db.phpt @@ -88,13 +88,16 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_select_db($link, $db))) - printf("[019] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_select_db($link, $db); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!\n"; ?> --CLEAN-- <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_select_db(): Couldn't fetch mysqli in %s on line %d +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_send_query.phpt b/ext/mysqli/tests/mysqli_send_query.phpt index d07985c2b7..5cdb0a6b77 100644 --- a/ext/mysqli/tests/mysqli_send_query.phpt +++ b/ext/mysqli/tests/mysqli_send_query.phpt @@ -40,11 +40,13 @@ if (!$TEST_EXPERIMENTAL) mysqli_close($link); - if (NULL !== ($tmp = mysqli_send_query($link, 'SELECT 1'))) - printf("[006] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); - + try { + mysqli_send_query($link, 'SELECT 1'); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> --EXPECTF-- -Warning: mysqli_send_query(): Couldn't fetch mysqli in %s on line %d +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_set_charset.phpt b/ext/mysqli/tests/mysqli_set_charset.phpt index 33ebb8347b..092e17b36c 100644 --- a/ext/mysqli/tests/mysqli_set_charset.phpt +++ b/ext/mysqli/tests/mysqli_set_charset.phpt @@ -104,8 +104,11 @@ if ((($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin1"', MYSQLI_STOR mysqli_close($link); - if (false !== ($tmp = mysqli_set_charset($link, $new_charset))) - printf("[019] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_set_charset($link, $new_charset); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -113,6 +116,6 @@ if ((($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin1"', MYSQLI_STOR <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_set_charset(): Couldn't fetch mysqli in %s on line %d +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_set_opt.phpt b/ext/mysqli/tests/mysqli_set_opt.phpt index 6769d2c530..b368654e59 100644 --- a/ext/mysqli/tests/mysqli_set_opt.phpt +++ b/ext/mysqli/tests/mysqli_set_opt.phpt @@ -28,11 +28,15 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - var_dump(mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1')); + try { + mysqli_set_opt($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=1'); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> ---EXPECTF-- +--EXPECT-- bool(true) bool(true) bool(true) @@ -45,7 +49,5 @@ bool(true) bool(true) bool(true) bool(false) - -Warning: mysqli_set_opt(): Couldn't fetch mysqli in %s on line %d -bool(false) +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_sqlstate.phpt b/ext/mysqli/tests/mysqli_sqlstate.phpt index 55dd115403..1d63e71da2 100644 --- a/ext/mysqli/tests/mysqli_sqlstate.phpt +++ b/ext/mysqli/tests/mysqli_sqlstate.phpt @@ -20,7 +20,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - var_dump(mysqli_sqlstate($link)); + try { + mysqli_sqlstate($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -32,7 +36,5 @@ require_once('skipifconnectfailure.inc'); %s(5) "00000" %s(5) "42S22" %s(5) "00000" - -Warning: mysqli_sqlstate(): Couldn't fetch mysqli in %s on line %d -bool(false) +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stat.phpt b/ext/mysqli/tests/mysqli_stat.phpt index 71f7af5a54..6369a366b3 100644 --- a/ext/mysqli/tests/mysqli_stat.phpt +++ b/ext/mysqli/tests/mysqli_stat.phpt @@ -18,11 +18,14 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_stat($link))) - printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stat($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> ---EXPECTF-- -Warning: mysqli_stat(): Couldn't fetch mysqli in %s on line %d +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt index cfe5d53516..2ba36389fd 100644 --- a/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt +++ b/ext/mysqli/tests/mysqli_stmt_affected_rows.phpt @@ -225,8 +225,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_affected_rows($stmt))) - printf("[047] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_affected_rows($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); @@ -238,6 +241,5 @@ require_once('skipifconnectfailure.inc'); ?> --EXPECTF-- [009] [%d] (error message varies with the MySQL Server version, check the error code) - -Warning: mysqli_stmt_affected_rows(): Couldn't fetch mysqli_stmt in %s on line %d +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt index f3634a7621..60920c2460 100644 --- a/ext/mysqli/tests/mysqli_stmt_attr_get.phpt +++ b/ext/mysqli/tests/mysqli_stmt_attr_get.phpt @@ -25,8 +25,12 @@ require_once('skipifconnectfailure.inc'); $stmt = mysqli_stmt_init($link); mysqli_stmt_prepare($stmt, 'SELECT * FROM test'); - if (false !== ($tmp = @mysqli_stmt_attr_get($stmt, $invalid_attr))) - printf("[005] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); + + try { + mysqli_stmt_attr_get($stmt, $invalid_attr); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } foreach ($valid_attr as $k => $attr) { if (false === ($tmp = mysqli_stmt_attr_get($stmt, $attr))) { @@ -38,10 +42,11 @@ require_once('skipifconnectfailure.inc'); $stmt->close(); foreach ($valid_attr as $k => $attr) { - if (false !== ($tmp = @mysqli_stmt_attr_get($stmt, $attr))) { - printf("[007] Expecting false, got %s/%s for attribute %s/%s\n", - gettype($tmp), $tmp, $k, $attr); - } + try { + mysqli_stmt_attr_get($stmt, $attr); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } } mysqli_close($link); @@ -52,4 +57,7 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECT-- +mysqli_stmt object is already closed +mysqli_stmt object is already closed +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt index 6e5710a0fc..d87b28e460 100644 --- a/ext/mysqli/tests/mysqli_stmt_attr_set.phpt +++ b/ext/mysqli/tests/mysqli_stmt_attr_set.phpt @@ -26,8 +26,11 @@ require_once("connect.inc"); $stmt = mysqli_stmt_init($link); - if (false !== ($tmp = @mysqli_stmt_attr_set($stmt, 0, 0))) - printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_attr_set($stmt, 0, 0); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } $stmt->prepare("SELECT * FROM test"); @@ -259,4 +262,5 @@ require_once("connect.inc"); require_once("clean_table.inc"); ?> --EXPECT-- +mysqli_stmt object is not fully initialized done! diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt index c166d91c48..40b5baf4ef 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_result.phpt @@ -22,8 +22,11 @@ require_once('skipifconnectfailure.inc'); $label = null; $foo = null; - if (false !== ($tmp = mysqli_stmt_bind_result($stmt, $id))) - printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_bind_result($stmt, $id); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1")) printf("[004] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -300,8 +303,7 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_stmt_bind_result(): invalid object or resource mysqli_stmt - in %s on line %d +mysqli_stmt object is not fully initialized Warning: mysqli_stmt_bind_result(): Number of bind variables doesn't match number of fields in prepared statement in %s on line %d diff --git a/ext/mysqli/tests/mysqli_stmt_close.phpt b/ext/mysqli/tests/mysqli_stmt_close.phpt index dfeab7075d..978e4388bb 100644 --- a/ext/mysqli/tests/mysqli_stmt_close.phpt +++ b/ext/mysqli/tests/mysqli_stmt_close.phpt @@ -16,8 +16,11 @@ require_once('skipifconnectfailure.inc'); printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); // Yes, amazing, eh? AFAIK a work around of a constructor bug... - if (false !== ($tmp = mysqli_stmt_close($stmt))) - printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_close($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -25,8 +28,11 @@ require_once('skipifconnectfailure.inc'); if (true !== ($tmp = mysqli_stmt_close($stmt))) printf("[006] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp); - if (false !== ($tmp = mysqli_stmt_close($stmt))) - printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_close($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!$stmt = mysqli_stmt_init($link)) printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); @@ -74,9 +80,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_stmt_close(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_close(): Couldn't fetch mysqli_stmt in %s on line %d +--EXPECT-- +mysqli_stmt object is not fully initialized +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt index 23ecea0be3..6658f6e855 100644 --- a/ext/mysqli/tests/mysqli_stmt_data_seek.phpt +++ b/ext/mysqli/tests/mysqli_stmt_data_seek.phpt @@ -15,8 +15,11 @@ require_once('skipifconnectfailure.inc'); if (!$stmt = mysqli_stmt_init($link)) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_stmt_data_seek($stmt, 1))) - printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_data_seek($stmt, 1); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id")) printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -66,8 +69,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_data_seek($stmt, 0))) - printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_data_seek($stmt, 0); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -77,14 +83,12 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_stmt_data_seek(): invalid object or resource mysqli_stmt - in %s on line %d +mysqli_stmt object is not fully initialized int(3) int(1) int(1) Warning: mysqli_stmt_data_seek(): Offset must be positive in %s on line %d int(1) - -Warning: mysqli_stmt_data_seek(): Couldn't fetch mysqli_stmt in %s on line %d +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_errno.phpt b/ext/mysqli/tests/mysqli_stmt_errno.phpt index 7b20ea65c6..79b3ae171d 100644 --- a/ext/mysqli/tests/mysqli_stmt_errno.phpt +++ b/ext/mysqli/tests/mysqli_stmt_errno.phpt @@ -44,8 +44,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_errno($stmt))) - printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_errno($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -54,6 +57,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_stmt_errno(): Couldn't fetch mysqli_stmt in %s on line %d +--EXPECT-- +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_error.phpt b/ext/mysqli/tests/mysqli_stmt_error.phpt index 2b7b59a21a..a0c1497247 100644 --- a/ext/mysqli/tests/mysqli_stmt_error.phpt +++ b/ext/mysqli/tests/mysqli_stmt_error.phpt @@ -44,8 +44,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_error($stmt))) - printf("[011] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_error($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -54,6 +57,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_stmt_error(): Couldn't fetch mysqli_stmt in %s on line %d +--EXPECT-- +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_execute.phpt b/ext/mysqli/tests/mysqli_stmt_execute.phpt index fd0fd3c628..7a3be215c5 100644 --- a/ext/mysqli/tests/mysqli_stmt_execute.phpt +++ b/ext/mysqli/tests/mysqli_stmt_execute.phpt @@ -22,15 +22,21 @@ if (mysqli_get_server_version($link) <= 40100) { printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); // stmt object status test - if (false !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_execute($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (mysqli_stmt_prepare($stmt, "SELECT i_do_not_exist_believe_me FROM test ORDER BY id")) printf("[005] Statement should have failed!\n"); // stmt object status test - if (false !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[006] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_execute($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test ORDER BY id LIMIT 1")) printf("[007] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -117,8 +123,11 @@ if (mysqli_get_server_version($link) <= 40100) { mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_execute($stmt))) - printf("[028] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_execute($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -127,15 +136,11 @@ if (mysqli_get_server_version($link) <= 40100) { <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_stmt_execute(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_execute(): invalid object or resource mysqli_stmt - in %s on line %d +--EXPECT-- +mysqli_stmt object is not fully initialized +mysqli_stmt object is not fully initialized bool(true) bool(true) [027] Expecting boolean/false, got boolean/1 - -Warning: mysqli_stmt_execute(): Couldn't fetch mysqli_stmt in %s on line %d +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_fetch.phpt b/ext/mysqli/tests/mysqli_stmt_fetch.phpt index 25a1f52eb1..6f8a3ad725 100644 --- a/ext/mysqli/tests/mysqli_stmt_fetch.phpt +++ b/ext/mysqli/tests/mysqli_stmt_fetch.phpt @@ -21,8 +21,11 @@ require_once('skipifconnectfailure.inc'); printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); // stmt object status test - if (false !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_fetch($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -64,8 +67,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[016] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_fetch($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); @@ -76,9 +82,7 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt - in %s on line %d +mysqli_stmt object is not fully initialized [014] [%d] Commands out of sync; you can't run this command now - -Warning: mysqli_stmt_fetch(): Couldn't fetch mysqli_stmt in %s on line %d +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_field_count.phpt b/ext/mysqli/tests/mysqli_stmt_field_count.phpt index 2fa8a8ac80..72cb2ecb03 100644 --- a/ext/mysqli/tests/mysqli_stmt_field_count.phpt +++ b/ext/mysqli/tests/mysqli_stmt_field_count.phpt @@ -13,14 +13,21 @@ require_once('skipifconnectfailure.inc'); require('table.inc'); $stmt = mysqli_stmt_init($link); - if (false !== ($tmp = mysqli_stmt_field_count($stmt))) - printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + + try { + mysqli_stmt_field_count($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (mysqli_stmt_prepare($stmt, '')) printf("[004] Prepare should fail for an empty statement\n"); - if (false !== ($tmp = mysqli_stmt_field_count($stmt))) - printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_field_count($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, 'SELECT 1')) printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -64,11 +71,17 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (mysqli_stmt_prepare($stmt, 'SELECT id FROM test')) - printf("[020] Prepare should fail, statement has been closed\n"); + try { + mysqli_stmt_prepare($stmt, 'SELECT id FROM test'); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - if (false !== ($tmp = mysqli_stmt_field_count($stmt))) - printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_field_count($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); @@ -79,15 +92,10 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_stmt_field_count(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_field_count(): invalid object or resource mysqli_stmt - in %s on line %d +mysqli_stmt object is not fully initialized +mysqli_stmt object is not fully initialized Warning: mysqli_stmt_bind_param(): Number of variables doesn't match number of parameters in prepared statement in %s on line %d - -Warning: mysqli_stmt_prepare(): Couldn't fetch mysqli_stmt in %s on line %d - -Warning: mysqli_stmt_field_count(): Couldn't fetch mysqli_stmt in %s on line %d +mysqli_stmt object is already closed +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_free_result.phpt b/ext/mysqli/tests/mysqli_stmt_free_result.phpt index 9d28d8a116..02e7352b28 100644 --- a/ext/mysqli/tests/mysqli_stmt_free_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_free_result.phpt @@ -21,8 +21,11 @@ require_once('skipifconnectfailure.inc'); printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); // stmt object status test - if (false !== ($tmp = mysqli_stmt_free_result($stmt))) - printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_free_result($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id")) printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -58,8 +61,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_free_result($stmt))) - printf("[015] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_free_result($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); @@ -69,9 +75,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_stmt_free_result(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_free_result(): Couldn't fetch mysqli_stmt in %s on line %d +--EXPECT-- +mysqli_stmt object is not fully initialized +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_get_result.phpt b/ext/mysqli/tests/mysqli_stmt_get_result.phpt index 594e112cac..998fa8e0b5 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result.phpt @@ -24,8 +24,11 @@ if (!function_exists('mysqli_stmt_get_result')) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); // stmt object status test - if (false !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[004] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + try { + mysqli_stmt_fetch($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -49,8 +52,11 @@ if (!function_exists('mysqli_stmt_get_result')) printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); // stmt object status test - if (false !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[011] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + try { + mysqli_stmt_fetch($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) printf("[012] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -72,8 +78,11 @@ if (!function_exists('mysqli_stmt_get_result')) printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); // stmt object status test - if (false !== ($tmp = mysqli_stmt_get_result($stmt))) - printf("[018] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + try { + mysqli_stmt_get_result($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 2")) printf("[019] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -139,8 +148,11 @@ if (!function_exists('mysqli_stmt_get_result')) mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_fetch($stmt))) - printf("[042] Expecting false, got %s/%s\n", gettype($tmp), var_export($tmp, 1)); + try { + mysqli_stmt_fetch($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); @@ -151,14 +163,9 @@ if (!function_exists('mysqli_stmt_get_result')) require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_get_result(): invalid object or resource mysqli_stmt - in %s on line %d +mysqli_stmt object is not fully initialized +mysqli_stmt object is not fully initialized +mysqli_stmt object is not fully initialized [038] [2014] [Commands out of sync; you can't run this command now] [039] [0] [] array(2) { @@ -173,6 +180,5 @@ array(2) { ["label"]=> %s(1) "b" } - -Warning: mysqli_stmt_fetch(): Couldn't fetch mysqli_stmt in %s on line %d +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt index ab261bd82b..f487868996 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result2.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result2.phpt @@ -132,18 +132,19 @@ if (!function_exists('mysqli_stmt_get_result')) mysqli_stmt_close($stmt); mysqli_close($link); - if (false !== ($res = mysqli_stmt_get_result($stmt))) { - printf("[026] Expecting false got %s/%s\n", - gettype($res), $res); - } + try { + mysqli_stmt_get_result($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - print "done!"; + print "done!"; ?> --CLEAN-- <?php require_once("clean_table.inc"); ?> ---EXPECTF-- +--EXPECT-- array(2) { ["id"]=> int(1) @@ -159,6 +160,5 @@ array(2) { } NULL [017] [2014] Commands out of sync; you can't run this command now - -Warning: mysqli_stmt_get_result(): Couldn't fetch mysqli_stmt in %s on line %d +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt index febc659167..fd0724ce79 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt @@ -193,15 +193,27 @@ if (!function_exists('mysqli_stmt_get_result')) $res->free_result(); mysqli_free_result($res_meta); - var_dump(mysqli_fetch_field($res)); + try { + mysqli_fetch_field($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_stmt_close($stmt); - var_dump(mysqli_fetch_field($res)); + try { + mysqli_fetch_field($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); - var_dump(mysqli_fetch_field($res)); + try { + mysqli_fetch_field($res); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -225,13 +237,7 @@ _id _label _null _label_concat - -Warning: mysqli_fetch_field(): Couldn't fetch mysqli_result in %s on line %d -bool(false) - -Warning: mysqli_fetch_field(): Couldn't fetch mysqli_result in %s on line %d -bool(false) - -Warning: mysqli_fetch_field(): Couldn't fetch mysqli_result in %s on line %d -bool(false) +mysqli_result object is already closed +mysqli_result object is already closed +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt index c63a91487b..a7db91034b 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt @@ -94,19 +94,31 @@ if (!function_exists('mysqli_stmt_get_result')) mysqli_free_result($res); - if (false !== ($tmp = mysqli_data_seek($res, 0))) - printf("[017] Expecting false got %s/%s\n", gettype($tmp), $tmp); - - if (false !== ($row = $res->fetch_array(MYSQLI_NUM))) - printf("[018] Expecting false got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_data_seek($res, 0); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } + + try { + $res->fetch_array(MYSQLI_NUM); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); - if (false !== ($tmp = mysqli_data_seek($res, 0))) - printf("[019] Expecting false got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_data_seek($res, 0); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - if (false !== ($row = $res->fetch_array(MYSQLI_NUM))) - printf("[020] Expecting false got %s/%s\n", gettype($tmp), $tmp); + try { + $res->fetch_array(MYSQLI_NUM); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -114,12 +126,9 @@ if (!function_exists('mysqli_stmt_get_result')) <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_data_seek(): Couldn't fetch mysqli_result in %s on line %d - -Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on line %d - -Warning: mysqli_data_seek(): Couldn't fetch mysqli_result in %s on line %d - -Warning: mysqli_result::fetch_array(): Couldn't fetch mysqli_result in %s on line %d +--EXPECT-- +mysqli_result object is already closed +mysqli_result object is already closed +mysqli_result object is already closed +mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt index 958a278554..83f6159540 100644 --- a/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt +++ b/ext/mysqli/tests/mysqli_stmt_get_warnings.phpt @@ -31,8 +31,11 @@ mysqli_query($link, "DROP TABLE IF EXISTS test"); if (!$stmt = mysqli_stmt_init($link)) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_stmt_get_warnings($stmt))) - printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_get_warnings($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SET sql_mode=''") || !mysqli_stmt_execute($stmt)) printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -83,8 +86,11 @@ mysqli_query($link, "DROP TABLE IF EXISTS test"); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_get_warnings($stmt))) - printf("[018] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_get_warnings($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -93,9 +99,7 @@ mysqli_query($link, "DROP TABLE IF EXISTS test"); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_stmt_get_warnings(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_get_warnings(): Couldn't fetch mysqli_stmt in %s on line %d +--EXPECT-- +mysqli_stmt object is not fully initialized +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_init.phpt b/ext/mysqli/tests/mysqli_stmt_init.phpt index c16f708fe6..2a692c4000 100644 --- a/ext/mysqli/tests/mysqli_stmt_init.phpt +++ b/ext/mysqli/tests/mysqli_stmt_init.phpt @@ -23,12 +23,19 @@ require_once('skipifconnectfailure.inc'); if (!is_object($stmt2 = @mysqli_stmt_init($link))) printf("[003a] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - mysqli_stmt_close($stmt); + try { + mysqli_stmt_close($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); - if (false !== ($tmp = mysqli_stmt_init($link))) - printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_init($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -36,9 +43,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_stmt_close(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_init(): Couldn't fetch mysqli in %s on line %d +--EXPECT-- +mysqli_stmt object is not fully initialized +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt index fedf305650..e2f8ad1cb2 100644 --- a/ext/mysqli/tests/mysqli_stmt_insert_id.phpt +++ b/ext/mysqli/tests/mysqli_stmt_insert_id.phpt @@ -13,8 +13,12 @@ require_once('skipifconnectfailure.inc'); require('table.inc'); $stmt = mysqli_stmt_init($link); - if (false !== ($tmp = @mysqli_stmt_insert_id($stmt))) - printf("[003] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + + try { + mysqli_stmt_insert_id($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test ORDER BY id LIMIT 1") || !mysqli_stmt_execute($stmt)) { @@ -53,7 +57,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - var_dump(mysqli_stmt_insert_id($stmt)); + try { + mysqli_stmt_insert_id($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -61,7 +69,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_stmt_insert_id(): Couldn't fetch mysqli_stmt in %s on line %d -bool(false) +--EXPECT-- +mysqli_stmt object is not fully initialized +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt index f798e22f71..22f707a105 100644 --- a/ext/mysqli/tests/mysqli_stmt_num_rows.phpt +++ b/ext/mysqli/tests/mysqli_stmt_num_rows.phpt @@ -92,8 +92,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_num_rows($stmt))) - printf("[056] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_num_rows($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -102,8 +105,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- +--EXPECT-- run_tests.php don't fool me with your 'ungreedy' expression '.+?'! - -Warning: mysqli_stmt_num_rows(): Couldn't fetch mysqli_stmt in %s on line %d +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_param_count.phpt b/ext/mysqli/tests/mysqli_stmt_param_count.phpt index 4176de60c5..5fa1b7c350 100644 --- a/ext/mysqli/tests/mysqli_stmt_param_count.phpt +++ b/ext/mysqli/tests/mysqli_stmt_param_count.phpt @@ -15,8 +15,11 @@ require_once('skipifconnectfailure.inc'); if (!$stmt = mysqli_stmt_init($link)) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_stmt_param_count($stmt))) - printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_param_count($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } function func_test_mysqli_stmt_param_count($stmt, $query, $expected, $offset) { @@ -39,8 +42,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_param_count($stmt))) - printf("[40] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_param_count($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); @@ -51,8 +57,6 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_stmt_param_count(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_param_count(): Couldn't fetch mysqli_stmt in %s on line %d +mysqli_stmt object is not fully initialized +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_prepare.phpt b/ext/mysqli/tests/mysqli_stmt_prepare.phpt index 52c7597ef6..be08d95749 100644 --- a/ext/mysqli/tests/mysqli_stmt_prepare.phpt +++ b/ext/mysqli/tests/mysqli_stmt_prepare.phpt @@ -29,8 +29,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_prepare($stmt, "SELECT id FROM test"))) - printf("[007] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_prepare($stmt, "SELECT id FROM test"); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -39,6 +42,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_stmt_prepare(): Couldn't fetch mysqli_stmt in %s on line %d +--EXPECT-- +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_reset.phpt b/ext/mysqli/tests/mysqli_stmt_reset.phpt index 339b885b72..654f09c337 100644 --- a/ext/mysqli/tests/mysqli_stmt_reset.phpt +++ b/ext/mysqli/tests/mysqli_stmt_reset.phpt @@ -21,8 +21,11 @@ require_once('skipifconnectfailure.inc'); if (!$stmt = mysqli_stmt_init($link)) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_stmt_reset($stmt))) - printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_reset($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (true !== ($tmp = mysqli_stmt_prepare($stmt, 'SELECT id FROM test'))) printf("[005] Expecting boolean/true, got %s/%s, [%d] %s\n", @@ -84,8 +87,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_reset($stmt))) - printf("[021] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_reset($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -94,10 +100,8 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_stmt_reset(): invalid object or resource mysqli_stmt - in %s on line %d +--EXPECT-- +mysqli_stmt object is not fully initialized int(1) - -Warning: mysqli_stmt_reset(): Couldn't fetch mysqli_stmt in %s on line %d +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt index adb7f6f726..12d240d8b9 100644 --- a/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt +++ b/ext/mysqli/tests/mysqli_stmt_result_metadata.phpt @@ -15,8 +15,11 @@ require_once('skipifconnectfailure.inc'); if (!$stmt = mysqli_stmt_init($link)) printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_stmt_result_metadata($stmt))) - printf("[004] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_result_metadata($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id, label FROM test")) printf("[005] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -73,8 +76,11 @@ require_once('skipifconnectfailure.inc'); mysqli_free_result($res); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_result_metadata($stmt))) - printf("[017] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_result_metadata($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -84,9 +90,8 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_stmt_result_metadata(): invalid object or resource mysqli_stmt - in %s on line %d -object(stdClass)#5 (13) { +mysqli_stmt object is not fully initialized +object(stdClass)#%d (13) { ["name"]=> string(2) "id" ["orgname"]=> @@ -114,6 +119,5 @@ object(stdClass)#5 (13) { ["decimals"]=> int(0) } - -Warning: mysqli_stmt_result_metadata(): Couldn't fetch mysqli_stmt in %s on line %d +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt index 2740195931..d9d3bb1dc0 100644 --- a/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt +++ b/ext/mysqli/tests/mysqli_stmt_sqlstate.phpt @@ -15,8 +15,11 @@ require_once('skipifconnectfailure.inc'); if (!$stmt = mysqli_stmt_init($link)) printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); - if (false !== ($tmp = mysqli_stmt_sqlstate($stmt))) - printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_sqlstate($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "SELECT id FROM test")) printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt)); @@ -33,8 +36,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); - if (false !== ($tmp = mysqli_stmt_sqlstate($stmt))) - printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_sqlstate($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); print "done!"; @@ -43,9 +49,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_stmt_sqlstate(): invalid object or resource mysqli_stmt - in %s on line %d - -Warning: mysqli_stmt_sqlstate(): Couldn't fetch mysqli_stmt in %s on line %d +--EXPECT-- +mysqli_stmt object is not fully initialized +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_store_result.phpt b/ext/mysqli/tests/mysqli_stmt_store_result.phpt index a6634e56f9..dba069223c 100644 --- a/ext/mysqli/tests/mysqli_stmt_store_result.phpt +++ b/ext/mysqli/tests/mysqli_stmt_store_result.phpt @@ -16,8 +16,11 @@ require_once('skipifconnectfailure.inc'); printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); // stmt object status test - if (false !== ($tmp = @mysqli_stmt_store_result($stmt))) - printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_store_result($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } if (!mysqli_stmt_prepare($stmt, "INSERT INTO test(id, label) VALUES (100, 'z')") || !mysqli_stmt_execute($stmt)) @@ -63,8 +66,11 @@ require_once('skipifconnectfailure.inc'); mysqli_stmt_close($stmt); mysqli_stmt_close($stmt_buf); - if (false !== ($tmp = @mysqli_stmt_store_result($stmt))) - printf("[017] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_stmt_store_result($stmt); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_close($link); mysqli_close($link_buf); @@ -75,4 +81,6 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECT-- +mysqli_stmt object is not fully initialized +mysqli_stmt object is already closed done! diff --git a/ext/mysqli/tests/mysqli_store_result.phpt b/ext/mysqli/tests/mysqli_store_result.phpt index 5ee8a14f6b..2d9f504eef 100644 --- a/ext/mysqli/tests/mysqli_store_result.phpt +++ b/ext/mysqli/tests/mysqli_store_result.phpt @@ -41,8 +41,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_store_result($link))) - printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_store_result($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -51,5 +54,5 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_store_result(): Couldn't fetch mysqli in %s on line %d +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_thread_id.phpt b/ext/mysqli/tests/mysqli_thread_id.phpt index f8e286b54c..1349410b09 100644 --- a/ext/mysqli/tests/mysqli_thread_id.phpt +++ b/ext/mysqli/tests/mysqli_thread_id.phpt @@ -21,8 +21,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_thread_id($link))) - printf("[005] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_thread_id($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -30,6 +33,6 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- -Warning: mysqli_thread_id(): Couldn't fetch mysqli in %s on line %d +--EXPECT-- +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_use_result.phpt b/ext/mysqli/tests/mysqli_use_result.phpt index 650a130c89..26ad3aabb4 100644 --- a/ext/mysqli/tests/mysqli_use_result.phpt +++ b/ext/mysqli/tests/mysqli_use_result.phpt @@ -41,8 +41,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_use_result($link))) - printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_use_result($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -52,6 +55,5 @@ require_once('skipifconnectfailure.inc'); ?> --EXPECTF-- Warning: mysqli_data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d - -Warning: mysqli_use_result(): Couldn't fetch mysqli in %s on line %d +mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_warning_count.phpt b/ext/mysqli/tests/mysqli_warning_count.phpt index 5e6a2e2381..6877843aa3 100644 --- a/ext/mysqli/tests/mysqli_warning_count.phpt +++ b/ext/mysqli/tests/mysqli_warning_count.phpt @@ -26,8 +26,11 @@ require_once('skipifconnectfailure.inc'); mysqli_close($link); - if (false !== ($tmp = mysqli_warning_count($link))) - printf("[010] Expecting false, got %s/%s\n", gettype($tmp), $tmp); + try { + mysqli_warning_count($link); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } print "done!"; ?> @@ -36,5 +39,5 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- -Warning: mysqli_warning_count(): Couldn't fetch mysqli in %s on line %d +mysqli object is already closed done! |