Skip to content

Remove E_STRICT notice in mysqli extension #4406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions ext/mysqli/mysqli_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1605,12 +1605,6 @@ PHP_FUNCTION(mysqli_next_result) {
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);

if (!mysql_more_results(mysql->mysql)) {
php_error_docref(NULL, E_STRICT, "There is no next result set. "
"Please, call mysqli_more_results()/mysqli::more_results() to check "
"whether to call this function/method");
}

RETURN_BOOL(!mysql_next_result(mysql->mysql));
}
/* }}} */
Expand Down Expand Up @@ -1643,12 +1637,6 @@ PHP_FUNCTION(mysqli_stmt_next_result) {
}
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);

if (!mysqlnd_stmt_more_results(stmt->stmt)) {
php_error_docref(NULL, E_STRICT, "There is no next result set. "
"Please, call mysqli_stmt_more_results()/mysqli_stmt::more_results() to check "
"whether to call this function/method");
}

RETURN_BOOL(!mysql_stmt_next_result(stmt->stmt));
}
/* }}} */
Expand Down
2 changes: 0 additions & 2 deletions ext/mysqli/tests/bug31668.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Bug #31668 (multi_query works exactly every other time (multi_query was global,
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--INI--
error_reporting = E_ALL & ~E_STRICT
--FILE--
<?php
require_once("connect.inc");
Expand Down
59 changes: 59 additions & 0 deletions ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
--TEST--
Fail gracefully on empty result set
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifemb.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
require_once("connect.inc");
require('table.inc');

// Returns only one result set
$link->multi_query("SELECT 1");
var_dump($link->next_result()); // should return false
var_dump($link->store_result()); // now what happens here!?


// Returns only one result set
$link->multi_query("SELECT 1");
var_dump($link->next_result());
var_dump($link->use_result());

$link->close();
?>
=== DONE ===
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECT--
bool(false)
object(mysqli_result)#3 (5) {
["current_field"]=>
int(0)
["field_count"]=>
int(1)
["lengths"]=>
NULL
["num_rows"]=>
int(1)
["type"]=>
int(0)
}
bool(false)
object(mysqli_result)#3 (5) {
["current_field"]=>
int(0)
["field_count"]=>
int(1)
["lengths"]=>
NULL
["num_rows"]=>
int(0)
["type"]=>
int(1)
}
=== DONE ===
4 changes: 0 additions & 4 deletions ext/mysqli/tests/mysqli_more_results.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,10 @@ 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
bool(false)
done!
5 changes: 1 addition & 4 deletions ext/mysqli/tests/mysqli_multi_query.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ require_once('skipifconnectfailure.inc');

mysqli_free_result($res);

} while (@mysqli_next_result($link));
} while (mysqli_next_result($link));

if ($res_num != 4)
printf("[015] Expecting 3 result sets got %d result set[s]\n", $res_num);
Expand All @@ -120,12 +120,9 @@ 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
[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
Expand Down
9 changes: 0 additions & 9 deletions ext/mysqli/tests/mysqli_next_result.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,6 @@ 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
bool(false)
Expand Down