mysqli_reap_async_query error reporting (#7629)

This commit is contained in:
Kamil Tekiela 2021-11-09 18:16:36 +00:00 committed by GitHub
parent 425e70c11c
commit 15a2c8660b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 2 deletions

View file

@ -957,6 +957,7 @@ PHP_FUNCTION(mysqli_reap_async_query)
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
if (FAIL == mysqlnd_reap_async_query(mysql->mysql)) {
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
RETURN_FALSE;
}
@ -978,8 +979,7 @@ PHP_FUNCTION(mysqli_reap_async_query)
}
if (!result) {
php_mysqli_throw_sql_exception((char *)mysql_sqlstate(mysql->mysql), mysql_errno(mysql->mysql),
"%s", mysql_error(mysql->mysql));
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
RETURN_FALSE;
}

View file

@ -0,0 +1,31 @@
--TEST--
mysqli_reap_async_query() error reporting
--EXTENSIONS--
mysqli
--SKIPIF--
<?php
require_once 'skipifconnectfailure.inc';
?>
--FILE--
<?php
require_once "connect.inc";
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
$link->query(')', MYSQLI_ASYNC | MYSQLI_USE_RESULT);
$reads = $errors = $rejects = [$link];
mysqli::poll($reads, $errors, $rejects, 1);
$link = $reads[0];
try {
$rs = $link->reap_async_query();
} catch (mysqli_sql_exception $exception) {
echo $exception->getMessage() . "\n";
}
print "done!";
?>
--EXPECT--
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
done!