Description
The following code:
<?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:
But I expected this output instead:
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
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