Skip to content

Commit

Permalink
Fix bug #75434 Wrong reflection for mysqli_fetch_all function
Browse files Browse the repository at this point in the history
  • Loading branch information
villfa authored and nikic committed Oct 28, 2017
1 parent 51ea2cf commit 938f256
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 3 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions ext/mysqli/mysqli_fe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
24 changes: 24 additions & 0 deletions ext/mysqli/tests/bug75434.phpt
Original file line number Diff line number Diff line change
@@ -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===
9 changes: 8 additions & 1 deletion ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 938f256

Please sign in to comment.