Bug #80991 [NEW]: There is no way to revoke reflection method with by-reference args
| From: | g dot sokol99 at g-sokol dot info | Date: | Mon, 26 Apr 2021 14:58:00 +0000 |
| Subject: | Bug #80991 [NEW]: There is no way to revoke reflection method with by-reference args | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-233579@lists.php.net to get a copy of this message | ||
From: g dot sokol99 at g-sokol dot info
Operating system: linux
PHP version: 7.4.16
Package: Reflection related
Bug Type: Bug
Bug description:There is no way to revoke reflection method with by-reference args
Description:
------------
If we have some method that receives some arguments my reference, there
is no way to invoke it with reflection.
Test script:
---------------
class TestReflectionMethodInvokeWithReferences
{
private static function testTarget(array &$a): void
{
$a['new_key'] = 'new value';
}
}
// Unit test use case
$testReflectionMethodInvokeWithReferences = new
ReflectionClass(TestReflectionMethodInvokeWithReferences::class);
$target =
$testReflectionMethodInvokeWithReferences->getMethod('testTarget');
$target->setAccessible(true);
$arg = [];
$target->invoke(null, &$arg);
var_exoprt($arg);
Expected result:
----------------
array (
'new_key' => 'new value',
)
Actual result:
--------------
PHP Parse error: syntax error, unexpected token "&", expecting ")" in
php shell code on line 5
--
Edit bug report at https://bugs.php.net/bug.php?id=80991&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80991&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80991&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80991&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80991&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80991&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80991&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80991&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80991&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80991&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80991&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80991&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80991&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80991&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80991&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80991&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80991&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80991&r=mysqlcfg