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

From: Date: Fri, 30 Oct 2020 16:24:12 +0000
Subject: Bug #80299 [Ver->Csd]: ReflectionFunction->invokeArgs confused in arguments
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230036@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80299&edit=1 ID: 80299 Updated by: nikic@php.net Reported by: roxblnfk at yandex dot com Summary: ReflectionFunction->invokeArgs confused in arguments -Status: Verified +Status: Closed Type: Bug Package: Reflection related Operating System: php:8.0-rc-cli-alpine PHP Version: 8.0.0RC3 Assigned To: nikic Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=904c1b6589b999a8e387215ac3c8fce9e4ab62a8 Log: FIxed bug #80299 Previous Comments: ------------------------------------------------------------------------ [2020-10-30 16:15:17] roxblnfk at yandex dot com 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 this bug report at https://bugs.php.net/bug.php?id=80299&edit=1

« previous php.bugs (#230036) next »