From: Nikita Popov Date: Sat, 3 Feb 2018 18:11:55 +0000 (+0100) Subject: Simplify E_STRICT handling in mysqli tests X-Git-Tag: php-7.3.0alpha1~486 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60c29a7f2b04a37476e9dc5fbba78a089f597012;p=php Simplify E_STRICT handling in mysqli tests E_STRICT is always defined, so we don't need to handle it conditionally. Instead just let the message be printed and check the output. --- diff --git a/ext/mysqli/tests/mysqli_more_results.phpt b/ext/mysqli/tests/mysqli_more_results.phpt index 271c63e1d1..4657c8c2f2 100644 --- a/ext/mysqli/tests/mysqli_more_results.phpt +++ b/ext/mysqli/tests/mysqli_more_results.phpt @@ -10,12 +10,6 @@ require_once('skipifconnectfailure.inc'); 41000 && !($ret = mysqli_more_results($link))) printf("[007] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret); do { @@ -47,17 +38,6 @@ require_once('skipifconnectfailure.inc'); printf("%d\n", $i++); } while (mysqli_next_result($link)); - if ($strict_on) { - $tmp = ob_get_contents(); - ob_end_clean(); - if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next result set@ismU', $tmp)) { - printf("[008] Strict Standards warning missing\n"); - } else { - $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on line \d+@ism', '', $tmp)); - } - print trim($tmp) . "\n"; - } - if (!mysqli_multi_query($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3")) printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link)); print "[010]\n"; @@ -65,8 +45,6 @@ require_once('skipifconnectfailure.inc'); if (mysqli_get_server_version($link) > 41000 && !($ret = mysqli_more_results($link))) printf("[011] Expecting boolean/true, got %s/%s\n", gettype($ret), $ret); - if ($strict_on) - ob_start(); do { $res = mysqli_use_result($link); // NOTE: if you use mysqli_use_result() with mysqli_more_results() or any other info function, @@ -79,16 +57,6 @@ require_once('skipifconnectfailure.inc'); printf("%d\n", $i++); } while (mysqli_next_result($link)); - if ($strict_on) { - $tmp = ob_get_contents(); - ob_end_clean(); - if (!preg_match('@Strict Standards: mysqli_next_result\(\): There is no next result set@ismU', $tmp)) { - printf("[008] Strict Standards warning missing\n"); - } else { - $tmp = trim(preg_replace('@Strict Standards: mysqli_next_result\(\).*on line \d+@ism', '', $tmp)); - } - print trim($tmp) . "\n"; - } mysqli_close($link); var_dump(mysqli_more_results($link)); @@ -105,10 +73,14 @@ bool(false) [006] 1 2 + +Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d [010] 1 2 +Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d + Warning: mysqli_more_results(): Couldn't fetch mysqli in %s on line %d NULL -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_multi_query.phpt b/ext/mysqli/tests/mysqli_multi_query.phpt index 91c07c2564..7cc84a0bf9 100644 --- a/ext/mysqli/tests/mysqli_multi_query.phpt +++ b/ext/mysqli/tests/mysqli_multi_query.phpt @@ -10,11 +10,6 @@ require_once('skipifconnectfailure.inc'); --EXPECTF-- + +Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d [006] 3 [008] 0 [009] [2014] Commands out of sync; you can't run this command now +Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d [010] 7 Warning: mysqli_multi_query(): Couldn't fetch mysqli in %s on line %d NULL -done! \ No newline at end of file +done! diff --git a/ext/mysqli/tests/mysqli_next_result.phpt b/ext/mysqli/tests/mysqli_next_result.phpt index c36920e1ec..37265696a4 100644 --- a/ext/mysqli/tests/mysqli_next_result.phpt +++ b/ext/mysqli/tests/mysqli_next_result.phpt @@ -10,12 +10,6 @@ require_once('skipifconnectfailure.inc'); = 100; SELECT 1 AS a; ", 11, 1, $strict_on); + func_test_mysqli_next_result($link, "SELECT 1 AS a; SELECT 1 AS a, 2 AS b; SELECT id FROM test ORDER BY id LIMIT 3", 5, 3); + func_test_mysqli_next_result($link, "SELECT 1 AS a; INSERT INTO test(id, label) VALUES (100, 'y'); SELECT 1 AS a, 2 AS b", 8, 2); + func_test_mysqli_next_result($link, "DELETE FROM test WHERE id >= 100; SELECT 1 AS a; ", 11, 1); mysqli_close($link); @@ -119,6 +73,16 @@ require_once('skipifconnectfailure.inc'); require_once("clean_table.inc"); ?> --EXPECTF-- +Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d + +Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d + +Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d + +Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d + +Strict Standards: mysqli_next_result(): There is no next result set. Please, call mysqli_more_results()/mysqli::more_results() to check whether to call this function/method in %s on line %d + Warning: mysqli_next_result(): Couldn't fetch mysqli in %s on line %d NULL -done! \ No newline at end of file +done!