ext/mysqi: mysqli_poll raises a ValueError on absent 1st and 2ng arguments.

This commit is contained in:
David Carlier 2023-03-14 20:34:46 +00:00
parent 394470c052
commit 90a39fd52c
3 changed files with 16 additions and 7 deletions

View File

@ -95,6 +95,8 @@ PHP 8.3 UPGRADE NOTES
- mysqli:
. mysqli_fetch_object now raises a ValueError instead of an Exception when the constructor_args
argument is non empty with the class not having constructor.
. mysqli_poll now raises a ValueError when the read nor error arguments are passed.
- PGSQL:
. pg_fetch_object now raises a ValueError instead of an Exception when the constructor_args
argument is non empty with the class not having constructor.

View File

@ -762,10 +762,9 @@ PHP_FUNCTION(mysqli_poll)
RETURN_THROWS();
}
// TODO Error promotion
if (!r_array && !e_array) {
php_error_docref(NULL, E_WARNING, "No stream arrays were passed");
RETURN_FALSE;
zend_value_error("No stream arrays were passed");
RETURN_THROWS();
}
if (r_array != NULL) {

View File

@ -10,15 +10,23 @@ require_once("connect.inc");
<?php
error_reporting(E_ALL);
$tablica = array();
$test1 = mysqli_poll($test2, $test3, $tablica, 0);
try {
$test1 = mysqli_poll($test2, $test3, $tablica, 0);
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
$test2 = array();
$test2 = array();
$test1 = mysqli_poll($test2, $test3, $tablica, 0);
try {
$test1 = mysqli_poll($test2, $test3, $tablica, 0);
} catch (\ValueError $e) {
echo $e->getMessage() . \PHP_EOL;
}
echo "okey";
?>
--EXPECTF--
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
No stream arrays were passed
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
Warning: mysqli_poll(): No stream arrays were passed in %s on line %d
okey