Bug #75434 [NEW]: Wrong reflection for mysqli_fetch_all function
| From: | hello at ohartl dot de | Date: | Tue, 24 Oct 2017 21:32:11 +0000 |
| Subject: | Bug #75434 [NEW]: Wrong reflection for mysqli_fetch_all function | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-212300@lists.php.net to get a copy of this message | ||
From: hello at ohartl dot de
Operating system: Ubuntu
PHP version: Irrelevant
Package: MySQLi related
Bug Type: Bug
Bug description:Wrong reflection for mysqli_fetch_all function
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 bug report at https://bugs.php.net/bug.php?id=75434&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75434&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75434&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75434&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75434&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75434&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75434&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75434&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75434&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75434&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75434&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75434&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75434&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75434&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75434&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75434&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75434&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75434&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75434&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75434&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75434&r=mysqlcfg