Skip to content

Commit e5bdd2c

Browse files
committed
Fixed bug #62885 (mysqli_poll - Segmentation fault)
1 parent 85fa4d7 commit e5bdd2c

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ PHP NEWS
2222
(reeze.xia@gmail.com)
2323
. Fixed bug #62500 (Segfault in DateInterval class when extended). (Laruence)
2424

25+
- MySQLnd:
26+
. Fixed bug #62885 (mysqli_poll - Segmentation fault). (Laruence)
27+
2528
- PDO:
2629
. Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence)
2730

ext/mysqli/mysqli_nonapi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,11 @@ PHP_FUNCTION(mysqli_poll)
705705
RETURN_FALSE;
706706
}
707707

708+
if (!r_array && !e_array) {
709+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "No stream arrays were passed");
710+
RETURN_FALSE;
711+
}
712+
708713
if (r_array != NULL) {
709714
mysqlnd_zval_array_to_mysqlnd_array(r_array, &new_r_array TSRMLS_CC);
710715
}

ext/mysqli/tests/bug62885.phpt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
--TEST--
2+
Bug #62885 (mysqli_poll - Segmentation fault)
3+
--SKIPIF--
4+
<?php
5+
require_once('skipif.inc');
6+
require_once("connect.inc");
7+
if (!$IS_MYSQLND) {
8+
die("skip mysqlnd only test");
9+
}
10+
?>
11+
--FILE--
12+
<?php
13+
error_reporting(E_ALL);
14+
$tablica = array();
15+
$test1 = mysqli_poll($test2, $test3, $tablica, null);
16+
17+
$test2 = array();
18+
$test2 = array();
19+
$test1 = mysqli_poll($test2, $test3, $tablica, null);
20+
echo "okey";
21+
?>
22+
--EXPECTF--
23+
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
24+
25+
Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d
26+
okey

0 commit comments

Comments
 (0)