php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75434 Wrong reflection for mysqli_fetch_all function
Submitted: 2017-10-24 21:32 UTC Modified: -
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: hello at ohartl dot de Assigned:
Status: Closed Package: MySQLi related
PHP Version: Irrelevant OS: Ubuntu
Private report: No CVE-ID: None
 [2017-10-24 21:32 UTC] 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)

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-24 22:12 UTC] 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-28 10:59 UTC] nikic@php.net
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
 [2017-10-28 10:59 UTC] nikic@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 10:01:29 2024 UTC