[php-src] Issue #20813: = new without $value creates it twice. Hooked object.

From: Date: Wed, 31 Dec 2025 00:38:11 +0000
Subject: [php-src] Issue #20813: = new without $value creates it twice. Hooked object.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-251452@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/20813 Author: ACEx86 ### Description The following code: ```php <?php $B = new B; $B->A = new A; Class B { Final Object $A{ get => $this->A; set(Object $value) => new A; } } Class A { public function __construct() { echo 'A'.PHP_EOL; } } ``` Resulted in this output: ``` A A ``` But I expected this output instead: ``` A ``` In the hooked variable set with = to new A instead of value will call it twice. If object is not equal to calling value don't do actions. ### PHP Version ```plain PHP 8.5.1 (cli) (built: Dec 16 2025 18:26:57) (NTS) Copyright (c) The PHP Group Zend Engine v4.5.1, Copyright (c) Zend Technologies with Zend OPcache v8.5.1, Copyright (c), by Zend Technologies ``` ### Operating System _No response_

« previous php.bugs (#251452) next »