[php-src] Issue #20151: Assign op in arrow function has no effect
| From: | mvorisek | Date: | Sun, 12 Oct 2025 19:16:38 +0000 |
| Subject: | [php-src] Issue #20151: Assign op in arrow function has no effect | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251044@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20151
Author: mvorisek
### Description
The following code:
```php
<?php
$log = [];
$appendToLogFx = static fn () => $log[] = 'foo';
$appendToLogFx();
var_dump($log);
```
repro: https://3v4l.org/aP6T0
Resulted in this output:
```
array(0) {
}
```
But I expected this output instead:
```
array(1) {
[0]=>
string(3) "foo"
}
(or error is append operation in arrow function is not supported)
```
### PHP Version
```plain
any
```
### Operating System
any