]> granicus.if.org Git - php/commitdiff
Fixed bug #62885 (mysqli_poll - Segmentation fault)
authorXinchen Hui <laruence@php.net>
Wed, 22 Aug 2012 05:41:47 +0000 (13:41 +0800)
committerXinchen Hui <laruence@php.net>
Wed, 22 Aug 2012 05:41:47 +0000 (13:41 +0800)
NEWS
ext/mysqli/mysqli_nonapi.c
ext/mysqli/tests/bug62885.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index b796117fddc847e1d96f85b4b47c0726866e40cb..3d156c1788554f4c4a5c74ee05df094393cfbcf6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,9 @@ PHP                                                                        NEWS
     (reeze.xia@gmail.com)
   . Fixed bug #62500 (Segfault in DateInterval class when extended). (Laruence)
 
+- MySQLnd:
+  . Fixed bug #62885 (mysqli_poll - Segmentation fault). (Laruence)
+
 - PDO:
   . Fixed bug #62685 (Wrong return datatype in PDO::inTransaction()). (Laruence)
 
index fbfc02e2fc74081791bb25d3f4c5bc25d8bb0c29..0ef67a2c44adbe5ce1915e1c1e388b0b85c35da5 100644 (file)
@@ -705,6 +705,11 @@ PHP_FUNCTION(mysqli_poll)
                RETURN_FALSE;
        }
 
+       if (!r_array && !e_array) {
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "No stream arrays were passed");
+               RETURN_FALSE;
+       }
+
        if (r_array != NULL) {
                mysqlnd_zval_array_to_mysqlnd_array(r_array, &new_r_array TSRMLS_CC);
        }
diff --git a/ext/mysqli/tests/bug62885.phpt b/ext/mysqli/tests/bug62885.phpt
new file mode 100644 (file)
index 0000000..9fb0aa0
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--\r
+Bug #62885 (mysqli_poll - Segmentation fault)\r
+--SKIPIF--\r
+<?php\r
+require_once('skipif.inc');\r
+require_once("connect.inc");\r
+if (!$IS_MYSQLND) {\r
+    die("skip mysqlnd only test");\r
+}\r
+?>\r
+--FILE--\r
+<?php\r
+error_reporting(E_ALL);\r
+$tablica = array();\r
+$test1 = mysqli_poll($test2, $test3, $tablica, null);\r
+\r
+$test2 = array();\r
+$test2 = array();\r
+$test1 = mysqli_poll($test2, $test3, $tablica, null);\r
+echo "okey";\r
+?>\r
+--EXPECTF--\r
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d\r
+\r
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line %d\r
+okey\r