mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
2447fd9f84
Reset fake_scope during __toString() call. I'll check if we can solve this more globally in master, by resetting fake_scope in zend_call_function.
36 lines
502 B
PHP
36 lines
502 B
PHP
--TEST--
|
|
Bug #79683: Fake reflection scope affects __toString()
|
|
--FILE--
|
|
<?php
|
|
|
|
class A
|
|
{
|
|
private string $prop1 = '123';
|
|
|
|
public function __toString()
|
|
{
|
|
return $this->prop1;
|
|
}
|
|
}
|
|
|
|
class B
|
|
{
|
|
private string $prop2;
|
|
}
|
|
|
|
$b = new B();
|
|
|
|
$reflector = new ReflectionClass($b);
|
|
$property = $reflector->getProperty('prop2');
|
|
$property->setAccessible(true);
|
|
$property->setValue($b, new A());
|
|
|
|
var_dump($b);
|
|
|
|
?>
|
|
--EXPECT--
|
|
object(B)#1 (1) {
|
|
["prop2":"B":private]=>
|
|
string(3) "123"
|
|
}
|