]> granicus.if.org Git - php/commitdiff
Fix bug #75434 Wrong reflection for mysqli_fetch_all function
authorFabien Villepinte <fabien.villepinte@gmail.com>
Sat, 28 Oct 2017 08:40:00 +0000 (10:40 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Sat, 28 Oct 2017 10:57:25 +0000 (12:57 +0200)
NEWS
ext/mysqli/mysqli_fe.c
ext/mysqli/tests/bug75434.phpt [new file with mode: 0644]
ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt

diff --git a/NEWS b/NEWS
index d1cfc0f8a4f8a096ee583f44056100eeb7aa1fbb..1dc5cf632e7847189c03372062bf6a4ee5c2db36 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,10 @@ PHP                                                                        NEWS
   . Fixed bug #75317 (UConverter::setDestinationEncoding changes source instead 
     of destination). (andrewnester)
 
+- Mysqli:
+  . Fixed bug #75434 (Wrong reflection for mysqli_fetch_all function). (Fabien
+    Villepinte)
+
 - OCI8:
   . Fixed valgrind issue. (Tianfang Yang)
 
index 3ac899c66016daa903abf3e80eee307bf9089725..4f1f4a3527e953ccc7c51ab652ecc2636bfef389 100644 (file)
@@ -420,7 +420,7 @@ const zend_function_entry mysqli_functions[] = {
        PHP_FE(mysqli_fetch_field_direct,                                       arginfo_mysqli_result_and_fieldnr)
        PHP_FE(mysqli_fetch_lengths,                                            arginfo_mysqli_only_result)
 #ifdef MYSQLI_USE_MYSQLND
-       PHP_FE(mysqli_fetch_all,                                                        arginfo_mysqli_only_result)
+       PHP_FE(mysqli_fetch_all,                                                        arginfo_mysqli_fetch_array)
 #endif
        PHP_FE(mysqli_fetch_array,                                                      arginfo_mysqli_fetch_array)
        PHP_FE(mysqli_fetch_assoc,                                                      arginfo_mysqli_only_result)
@@ -600,7 +600,7 @@ const zend_function_entry mysqli_result_methods[] = {
        PHP_FALIAS(fetch_fields, mysqli_fetch_fields, arginfo_mysqli_no_params)
        PHP_FALIAS(fetch_field_direct, mysqli_fetch_field_direct, arginfo_class_mysqli_result_and_fieldnr)
 #if defined(MYSQLI_USE_MYSQLND)
-       PHP_FALIAS(fetch_all, mysqli_fetch_all, arginfo_mysqli_no_params)
+       PHP_FALIAS(fetch_all, mysqli_fetch_all, arginfo_class_mysqli_fetch_array)
 #endif
        PHP_FALIAS(fetch_array, mysqli_fetch_array, arginfo_class_mysqli_fetch_array)
        PHP_FALIAS(fetch_assoc, mysqli_fetch_assoc, arginfo_mysqli_no_params)
diff --git a/ext/mysqli/tests/bug75434.phpt b/ext/mysqli/tests/bug75434.phpt
new file mode 100644 (file)
index 0000000..88050ec
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+Bug #75434 Wrong reflection for mysqli_fetch_all function
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+if (!extension_loaded("reflection")) die("skip reflection extension not available");
+?>
+--FILE--
+<?php
+$rf = new ReflectionFunction('mysqli_fetch_all');
+var_dump($rf->getNumberOfParameters());
+var_dump($rf->getNumberOfRequiredParameters());
+
+$rm = new ReflectionMethod('mysqli_result', 'fetch_all');
+var_dump($rm->getNumberOfParameters());
+var_dump($rm->getNumberOfRequiredParameters());
+?>
+===DONE===
+--EXPECT--
+int(2)
+int(1)
+int(1)
+int(0)
+===DONE===
index 95400e43e0fbd1611b5002fbd7be334f359afdf3..8f0ca2114380ea36972192e25ea61e6b97d1e896 100644 (file)
@@ -124,9 +124,16 @@ isInternal: yes
 isUserDefined: no
 returnsReference: no
 Modifiers: 256
-Number of Parameters: 0
+Number of Parameters: 1
 Number of Required Parameters: 0
 
+Inspecting parameter 'result_type' of method 'fetch_all'
+isArray: no
+allowsNull: no
+isPassedByReference: no
+isOptional: yes
+isDefaultValueAvailable: no
+
 Inspecting method 'fetch_array'
 isFinal: no
 isAbstract: no