Bug #80299 [NEW]: ReflectionFunction->invokeArgs confused in arguments

From: Date: Fri, 30 Oct 2020 16:15:17 +0000
Subject: Bug #80299 [NEW]: ReflectionFunction->invokeArgs confused in arguments
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230034@lists.php.net to get a copy of this message
From: roxblnfk at yandex dot com Operating system: php:8.0-rc-cli-alpine PHP version: 8.0.0RC3 Package: Reflection related Bug Type: Bug Bug description:ReflectionFunction->invokeArgs confused in arguments Description: ------------ Something goes wrong after generating a warning in the ReflectionFunction->invokeArgs() method. A Fatal error is thrown right after the Warning. Docker image php:8.0-rc-cli-alpine PHP 8.0.0RC3 (cli) (built: Oct 29 2020 21:50:53) ( NTS ) Test script: --------------- <?php $bar = new DateTime(); $args = [1, &$bar]; $function = function (int &$foo, DateTimeInterface &$bar) {}; (new ReflectionFunction($function))->invokeArgs($args); Expected result: ---------------- Warning: {closure}(): Argument #1 ($foo) must be passed by reference, value given in /app/test.php on line 9 Actual result: -------------- Warning: {closure}(): Argument #1 ($foo) must be passed by reference, value given in /app/test.php on line 9 Fatal error: Uncaught TypeError: {closure}(): Argument #2 ($bar) must be of type DateTimeInterface, number given in /app/test.php:6 Stack trace: #0 [internal function]: {closure}(1, Object(DateTime)) #1 /app/test.php(9): ReflectionFunction->invokeArgs(Array) #2 {main} thrown in /app/test.php on line 6 -- Edit bug report at https://bugs.php.net/bug.php?id=80299&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80299&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80299&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80299&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80299&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80299&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80299&r=support Expected behavior: https://bugs.php.net/fix.php?id=80299&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80299&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80299&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80299&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80299&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80299&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80299&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80299&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80299&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80299&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80299&r=mysqlcfg

« previous php.bugs (#230034) next »