blob: 766571918afb6fc6d5eb487ab94f3c4ea6d011a9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
--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"
}
|