-
Notifications
You must be signed in to change notification settings - Fork 269
/
Copy pathdynamic_properties3.phpt
52 lines (44 loc) · 1 KB
/
dynamic_properties3.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
42
43
44
45
46
47
48
49
50
51
52
--TEST--
PHP Spec test generated from ./classes/dynamic_properties3.php
--FILE--
<?php
/*
+-------------------------------------------------------------+
| Copyright (c) 2014 Facebook, Inc. (http://www.facebook.com) |
+-------------------------------------------------------------+
*/
error_reporting(-1);
class C
{
public function __get($name) {
echo "get\n";
return $this->$name; // must not recurse
}
public function __set($name, $val) {
echo "set\n";
$this->$name = $val; // must not recurse
}
public function __isset($name) {
echo "isset\n";
return isset($this->$name); // must not recurse
}
public function __unset($name) {
echo "unset\n";
unset($this->$name); // must not recurse
}
}
$c = new C;
$x = $c->prop; // Undefined property: C::$prop
$c->prop = 123; // Defined now
$x = $c->prop;
var_dump($x);
var_dump($c);
--EXPECTF--
get
Notice: Undefined property: C::$prop in %s on line %d
set
int(123)
object(C)#1 (1) {
["prop"]=>
int(123)
}