[php-src] Issue #12102: Fatal error: Cannot use result of built-in function in write context
| From: | mvorisek | Date: | Fri, 01 Sep 2023 13:57:47 +0000 |
| Subject: | [php-src] Issue #12102: Fatal error: Cannot use result of built-in function in write context | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-245311@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/12102
Author: mvorisek
### Description
The following code:
repro: https://3v4l.org/E8CsC
```php
<?php
class Cl {
public static function createAnd(...$args)
{
var_dump($args);
}
public function bar() {
static::createAnd(func_get_args()[0]);
}
}
(new Cl())->bar('y');
```
Resulted in this output:
```
Fatal error: Cannot use result of built-in function in write context
```
But I expected this output instead:
```
array(1) {
[0]=>
string(1) "y"
}
```
the 3v4l repro shows the issue is present only in some cases, when the same code is in non-class
AST, it works
### PHP Version
any
### Operating System
any