[php-src] Issue #15419: Property initialization with property hooks

From: Date: Thu, 15 Aug 2024 00:42:01 +0000
Subject: [php-src] Issue #15419: Property initialization with property hooks
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-247499@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/15419 Author: SerafimArts ### Description Referenced RFC https://github.com/php/php-src/pull/13455 The following code: ```php <?php final readonly class ReadonlyClassWithProperty { public const int DEFAULT_VALUE = 640; public function __construct( public int $value = self::DEFAULT_VALUE { set(int $value) => $value; }, ) {} } $ctx = new ReadonlyClassWithProperty(); $ctx = new ReadonlyClassWithProperty(); ``` Resulted in this output: ``` *nothing* ``` But I expected this output instead: ``` PHP Fatal error: Uncaught Error: Cannot modify readonly property ReadonlyClassWithProperty::$value in ... Stack trace: #0 ...: ReadonlyClassWithProperty->$value::set(640) #1 ...: ReadonlyClassWithProperty->__construct() #2 {main} thrown in ... ``` @iluuu1994 I mention you again, this time it's a not known issue, right?) ### PHP Version PHP 8.4-beta1 ### Operating System _No response_

« previous php.bugs (#247499) next »