forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgh18038-007.phpt
41 lines (35 loc) · 858 Bytes
/
gh18038-007.phpt
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
36
37
38
39
40
41
--TEST--
GH-18038 007: Lazy proxy calls magic methods twice
--FILE--
<?php
#[AllowDynamicProperties]
class RealInstance {
public $_;
public function __isset($name) {
global $obj;
var_dump(get_class($this)."::".__FUNCTION__);
var_dump(isset($obj->$name['']));
return isset($this->$name['']);
}
}
#[AllowDynamicProperties]
class Proxy extends RealInstance {
public function __isset($name) {
var_dump(get_class($this)."::".__FUNCTION__);
return isset($this->$name['']);
}
}
$rc = new ReflectionClass(Proxy::class);
$obj = $rc->newLazyProxy(function () {
echo "init\n";
return new RealInstance;
});
$real = $rc->initializeLazyObject($obj);
var_dump(isset($real->prop['']));
?>
--EXPECT--
init
string(21) "RealInstance::__isset"
string(14) "Proxy::__isset"
bool(false)
bool(false)