Closed as not planned
Description
Description
When ??
is used to check a property using magic methods, PHP unconditionnaly calls both __isset and __get even when __isset did actually set the property.
Reproducer: https://3v4l.org/cDlNW
This script:
#[AllowDynamicProperties]
class A
{
public function __get($n)
{
echo __FUNCTION__, "\n";
return $this->$n;
}
public function __isset($n)
{
echo __FUNCTION__, "\n";
$this->$n = 123;
return true;
}
}
$a = new A;
echo $a->foo ?? 234;
echoes this:
__isset
__get
123
while it should echo this:
__isset
123
PHP Version
All since 7.0.6
Operating System
No response