Commit:    e5bdd2c0eeab50dc1f863dae9a32d3857ece6a79
Author:    Xinchen Hui <larue...@php.net>         Wed, 22 Aug 2012 13:41:47 
+0800
Parents:   85fa4d7747b79852474928bcd201c40de86b0bec
Branches:  PHP-5.3

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=e5bdd2c0eeab50dc1f863dae9a32d3857ece6a79

Log:
Fixed bug #62885 (mysqli_poll - Segmentation fault)

Bugs:
https://bugs.php.net/62885

Changed paths:
  M  NEWS
  M  ext/mysqli/mysqli_nonapi.c
  A  ext/mysqli/tests/bug62885.phpt


Diff:
diff --git a/NEWS b/NEWS
index b796117..3d156c1 100644
--- a/NEWS
+++ b/NEWS
@@ -22,6 +22,9 @@ PHP                                                           
             NEWS
     (reeze....@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)
 
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index fbfc02e..0ef67a2 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -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
index 0000000..9fb0aa0
--- /dev/null
+++ b/ext/mysqli/tests/bug62885.phpt
@@ -0,0 +1,26 @@
+--TEST--
+Bug #62885 (mysqli_poll - Segmentation fault)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once("connect.inc");
+if (!$IS_MYSQLND) {
+    die("skip mysqlnd only test");
+}
+?>
+--FILE--
+<?php
+error_reporting(E_ALL);
+$tablica = array();
+$test1 = mysqli_poll($test2, $test3, $tablica, null);
+
+$test2 = array();
+$test2 = array();
+$test1 = mysqli_poll($test2, $test3, $tablica, null);
+echo "okey";
+?>
+--EXPECTF--
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line 
%d
+
+Warning: mysqli_poll(): No stream arrays were passed in %sbug62885.php on line 
%d
+okey


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to