Bug #75434 [Opn->Csd]: Wrong reflection for mysqli_fetch_all function

From: Date: Sat, 28 Oct 2017 10:59:46 +0000
Subject: Bug #75434 [Opn->Csd]: Wrong reflection for mysqli_fetch_all function
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-212346@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75434&edit=1

 ID:                 75434
 Updated by:         nikic@php.net
 Reported by:        hello at ohartl dot de
 Summary:            Wrong reflection for mysqli_fetch_all function
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            MySQLi related
 Operating System:   Ubuntu
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of fabien.villepinte@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=938f256ed90ea8b2e371ab6a50b953aa84d2c5f8
Log: Fix bug #75434 Wrong reflection for mysqli_fetch_all function


Previous Comments:
------------------------------------------------------------------------
[2017-10-24 22:12:15] mavimo at gmail dot com

Expected and actual results seems need to be:


Actual result:
----------------
int(1)
int(1)
int(0)
int(0)


Expected result:
--------------
int(2)
int(1)
int(1)
int(0)

------------------------------------------------------------------------
[2017-10-24 21:32:07] hello at ohartl dot de

Description:
------------
Reflection for procedural style function "mysqli_fetch_all" only returns the first
(required) parameter "result", but the second optional parameter "resulttype" is
missing. Also the reflection for "mysqli_result::fetch_all" does not return any parameter,
while one "resulttype" is optional. (see https://secure.php.net/mysqli_fetch_all)

There was no point in writing more complex tests to demonstrate the problem.

This caused problems in phpstan https://github.com/phpstan/phpstan/issues/549

Test script:
---------------
$reflection = new \ReflectionFunction('mysqli_fetch_all');
$parameters = $reflection->getParameters();
var_dump($reflection->getNumberOfParameters());
var_dump($reflection->getNumberOfRequiredParameters());

$reflection = new \ReflectionMethod('mysqli_result', 'fetch_all');
$parameters = $reflection->getParameters();
var_dump($reflection->getNumberOfParameters());
var_dump($reflection->getNumberOfRequiredParameters());


Expected result:
----------------
int(1)
int(1)
int(0)
int(0)

Actual result:
--------------
int(2)
int(1)
int(1)
int(0)


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=75434&edit=1


Thread (3 messages)

« previous php.bugs (#212346) next »