Skip to content

Commit 90a39fd

Browse files
committed
ext/mysqi: mysqli_poll raises a ValueError on absent 1st and 2ng arguments.
1 parent 394470c commit 90a39fd

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

UPGRADING

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ PHP 8.3 UPGRADE NOTES
9595
- mysqli:
9696
. mysqli_fetch_object now raises a ValueError instead of an Exception when the constructor_args
9797
argument is non empty with the class not having constructor.
98+
. mysqli_poll now raises a ValueError when the read nor error arguments are passed.
99+
98100
- PGSQL:
99101
. pg_fetch_object now raises a ValueError instead of an Exception when the constructor_args
100102
argument is non empty with the class not having constructor.

ext/mysqli/mysqli_nonapi.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -762,10 +762,9 @@ PHP_FUNCTION(mysqli_poll)
762762
RETURN_THROWS();
763763
}
764764

765-
// TODO Error promotion
766765
if (!r_array && !e_array) {
767-
php_error_docref(NULL, E_WARNING, "No stream arrays were passed");
768-
RETURN_FALSE;
766+
zend_value_error("No stream arrays were passed");
767+
RETURN_THROWS();
769768
}
770769

771770
if (r_array != NULL) {

ext/mysqli/tests/bug62885.phpt

+12-4
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,23 @@ require_once("connect.inc");
1010
<?php
1111
error_reporting(E_ALL);
1212
$tablica = array();
13-
$test1 = mysqli_poll($test2, $test3, $tablica, 0);
13+
try {
14+
$test1 = mysqli_poll($test2, $test3, $tablica, 0);
15+
} catch (\ValueError $e) {
16+
echo $e->getMessage() . \PHP_EOL;
17+
}
1418

1519
$test2 = array();
1620
$test2 = array();
17-
$test1 = mysqli_poll($test2, $test3, $tablica, 0);
21+
try {
22+
$test1 = mysqli_poll($test2, $test3, $tablica, 0);
23+
} catch (\ValueError $e) {
24+
echo $e->getMessage() . \PHP_EOL;
25+
}
1826
echo "okey";
1927
?>
2028
--EXPECTF--
21-
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
29+
No stream arrays were passed
2230

23-
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
31+
Warning: mysqli_poll(): No stream arrays were passed in %s on line %d
2432
okey

0 commit comments

Comments
 (0)