mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
mysqli_reap_async_query error reporting (#7629)
This commit is contained in:
parent
425e70c11c
commit
15a2c8660b
2 changed files with 33 additions and 2 deletions
|
@ -957,6 +957,7 @@ PHP_FUNCTION(mysqli_reap_async_query)
|
||||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||||
|
|
||||||
if (FAIL == mysqlnd_reap_async_query(mysql->mysql)) {
|
if (FAIL == mysqlnd_reap_async_query(mysql->mysql)) {
|
||||||
|
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -978,8 +979,7 @@ PHP_FUNCTION(mysqli_reap_async_query)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!result) {
|
if (!result) {
|
||||||
php_mysqli_throw_sql_exception((char *)mysql_sqlstate(mysql->mysql), mysql_errno(mysql->mysql),
|
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
|
||||||
"%s", mysql_error(mysql->mysql));
|
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
31
ext/mysqli/tests/mysqli_reap_async_query_error.phpt
Normal file
31
ext/mysqli/tests/mysqli_reap_async_query_error.phpt
Normal 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!
|
Loading…
Add table
Add a link
Reference in a new issue