[php-src] Issue #11067: readonly class and reset
| From: | ebrahimradi | Date: | Thu, 13 Apr 2023 07:39:21 +0000 |
| Subject: | [php-src] Issue #11067: readonly class and reset | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244185@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11067
Author: ebrahimradi
### Description
The following code:
```php
<?php
php > readonly class A{public function __construct(public array $a){}}
php > $a = new A([1,2,3]);
php > var_dump(reset($a->a));
```
Resulted in this output:
```
Warning: Uncaught Error: Cannot modify readonly property A::$a in php shell code:1
Stack trace:
#0 {main}
thrown in php shell code on line 1
```
But I expected this output normally as reset does NOT modify it. maybe it modify the pointer but not
the data.
### PHP Version
PHP 8.2.3
### Operating System
_No response_