]> granicus.if.org Git - php/commitdiff
MFH: Fix #47050 mysqli_poll() modifies improper variables
authorJohannes Schlüter <johannes@php.net>
Mon, 12 Jan 2009 14:04:32 +0000 (14:04 +0000)
committerJohannes Schlüter <johannes@php.net>
Mon, 12 Jan 2009 14:04:32 +0000 (14:04 +0000)
NEWS
ext/mysqli/mysqli_fe.c
ext/mysqli/tests/bug47050.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 1c0df85f4842f527146eaa53ce8782c2b2fcf591..ad2e107eb3613c30af98a2c1f76c8ece2fa6c9c8 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -27,6 +27,7 @@ PHP                                                                        NEWS
 - Added ICU support to SQLite3 when using the bundled version. (Scott)
 - Enabled the salsa hashing functions. (Scott)
 
+- Fixed bug #47050 (mysqli_poll() modifies improper variables). (Johannes)
 - Fixed bug #46957 (The tokenizer returns deprecated values). (Felipe)
 - Fixed bug #46944 (UTF-8 characters outside the BMP aren't encoded correctly).
   (Scott)
index 057b5f091501f4e59997620bf05f7549050728d7..c4724f4a365979ff29ca568a3622636d5330d7c5 100644 (file)
@@ -42,6 +42,13 @@ ZEND_END_ARG_INFO();
 ZEND_BEGIN_ARG_INFO(all_args_force_by_ref, 1)
 ZEND_END_ARG_INFO();
 
+ZEND_BEGIN_ARG_INFO_EX(arginfo_mysqli_poll, 0, 0, 4)
+       ZEND_ARG_ARRAY_INFO(1, read, 1)
+       ZEND_ARG_ARRAY_INFO(1, write, 1)
+       ZEND_ARG_ARRAY_INFO(1, error, 1)
+       ZEND_ARG_INFO(0, sec)
+       ZEND_ARG_INFO(0, usec)
+ZEND_END_ARG_INFO();
 
 /* {{{ mysqli_functions[]
  *
@@ -114,7 +121,7 @@ const zend_function_entry mysqli_functions[] = {
        PHP_FE(mysqli_options,                                                          NULL)
        PHP_FE(mysqli_ping,                                                                     NULL)
 #if defined(MYSQLI_USE_MYSQLND)
-       PHP_FE(mysqli_poll,                                                                     NULL)
+       PHP_FE(mysqli_poll,                                                                     arginfo_mysqli_poll)
 #endif
        PHP_FE(mysqli_prepare,                                                          NULL)
        PHP_FE(mysqli_report,                                                           NULL)
diff --git a/ext/mysqli/tests/bug47050.phpt b/ext/mysqli/tests/bug47050.phpt
new file mode 100644 (file)
index 0000000..7d936e7
--- /dev/null
@@ -0,0 +1,31 @@
+--TEST--
+Bug #47050 (mysqli_poll() modifies improper variables)
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifconnectfailure.inc');
+?>
+--FILE--
+<?php
+       include ("connect.inc");
+
+       $link1 = mysqli_connect($host, $user, $passwd, null, $port, $socket);
+       mysqli_select_db($link1, $db);
+
+       $link1->query("SELECT 'test'", MYSQLI_ASYNC);
+       $all_links = array($link1);
+       $links = $errors = $reject = $all_links;
+       mysqli_poll($links, $errors, $reject, 1);
+
+       echo "links: ",     sizeof($links), "\n";
+       echo "errors: ",    sizeof($errors), "\n";
+       echo "reject: ",    sizeof($reject), "\n";
+       echo "all_links: ", sizeof($all_links), "\n";
+
+       $link1->close();
+?>
+--EXPECT--
+links: 1
+errors: 0
+reject: 0
+all_links: 1