summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabien Villepinte <fabien.villepinte@gmail.com>2017-10-28 10:40:00 +0200
committerNikita Popov <nikita.ppv@gmail.com>2017-10-28 12:57:25 +0200
commit938f256ed90ea8b2e371ab6a50b953aa84d2c5f8 (patch)
treeef251fc6a887177b27f09ac6224e0dccf576bce2
parent51ea2cfbe1c8c3cbfdc381c6f2ff4d43af520938 (diff)
downloadphp-git-938f256ed90ea8b2e371ab6a50b953aa84d2c5f8.tar.gz
Fix bug #75434 Wrong reflection for mysqli_fetch_all function
-rw-r--r--NEWS4
-rw-r--r--ext/mysqli/mysqli_fe.c4
-rw-r--r--ext/mysqli/tests/bug75434.phpt24
-rw-r--r--ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt9
4 files changed, 38 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index d1cfc0f8a4..1dc5cf632e 100644
--- 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)
diff --git a/ext/mysqli/mysqli_fe.c b/ext/mysqli/mysqli_fe.c
index 3ac899c660..4f1f4a3527 100644
--- a/ext/mysqli/mysqli_fe.c
+++ b/ext/mysqli/mysqli_fe.c
@@ -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
index 0000000000..88050ec4a5
--- /dev/null
+++ b/ext/mysqli/tests/bug75434.phpt
@@ -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===
diff --git a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
index 95400e43e0..8f0ca21143 100644
--- a/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
+++ b/ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
@@ -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