Annotation of embedaddon/php/ext/reflection/tests/bug40431.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #40431 (dynamic properties may cause crash in ReflectionProperty methods)
3: --FILE--
4: <?php
5:
6: echo "=== 1st test ===\n";
7:
8: $Obj->value = 'value';
9: $RefObj = new ReflectionObject($Obj);
10:
11: $props = $RefObj->getProperties();
12:
13: var_dump($props);
14: var_dump($props[0]->isStatic());
15: var_dump($props[0]->isPrivate());
16: var_dump($props[0]->isPublic());
17: var_dump($props[0]->isProtected());
18:
19: echo "=== 2nd test ===\n";
20:
21: class test1 {
22: }
23:
24: class test2 extends test1{
25: }
26:
27: $Obj = new test2;
28: $Obj->value = 'value';
29: $RefObj = new ReflectionObject($Obj);
30:
31: $props = $RefObj->getProperties();
32:
33: var_dump($props);
34: var_dump($props[0]->isStatic());
35: var_dump($props[0]->isPrivate());
36: var_dump($props[0]->isPublic());
37: var_dump($props[0]->isProtected());
38:
39: echo "=== 3rd test ===\n";
40:
41: class test3 {
42: }
43:
44: $Obj = new test3;
45: $Obj->value = 'value';
46: $RefObj = new ReflectionObject($Obj);
47:
48: $props = $RefObj->getProperties();
49:
50: var_dump($props);
51: var_dump($props[0]->isStatic());
52: var_dump($props[0]->isPrivate());
53: var_dump($props[0]->isPublic());
54: var_dump($props[0]->isProtected());
55:
56: echo "=== 4th test ===\n";
57:
58: class test5 {
59: private $value = 1;
60: }
61:
62: class test4 extends test5{
63: }
64:
65: $Obj = new test4;
66: $Obj->value = 'value';
67: $RefObj = new ReflectionObject($Obj);
68:
69: $props = $RefObj->getProperties();
70:
71: var_dump($props);
72: var_dump($props[0]->isStatic());
73: var_dump($props[0]->isPrivate());
74: var_dump($props[0]->isPublic());
75: var_dump($props[0]->isProtected());
76:
77: echo "Done\n";
78: ?>
79: --EXPECTF--
80: === 1st test ===
81:
82: Strict Standards: Creating default object from empty value in %s on line %d
83: array(1) {
84: [0]=>
85: &object(ReflectionProperty)#%d (2) {
86: ["name"]=>
87: string(5) "value"
88: ["class"]=>
89: string(8) "stdClass"
90: }
91: }
92: bool(false)
93: bool(false)
94: bool(true)
95: bool(false)
96: === 2nd test ===
97: array(1) {
98: [0]=>
99: &object(ReflectionProperty)#%d (2) {
100: ["name"]=>
101: string(5) "value"
102: ["class"]=>
103: string(5) "test2"
104: }
105: }
106: bool(false)
107: bool(false)
108: bool(true)
109: bool(false)
110: === 3rd test ===
111: array(1) {
112: [0]=>
113: &object(ReflectionProperty)#%d (2) {
114: ["name"]=>
115: string(5) "value"
116: ["class"]=>
117: string(5) "test3"
118: }
119: }
120: bool(false)
121: bool(false)
122: bool(true)
123: bool(false)
124: === 4th test ===
125: array(1) {
126: [0]=>
127: &object(ReflectionProperty)#%d (2) {
128: ["name"]=>
129: string(5) "value"
130: ["class"]=>
131: string(5) "test4"
132: }
133: }
134: bool(false)
135: bool(false)
136: bool(true)
137: bool(false)
138: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>