Annotation of embedaddon/php/ext/reflection/tests/bug46064.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #46064 (Exception when creating ReflectionProperty object on dynamicly created property)
3: --FILE--
4: <?php
5:
6: class x {
7: public $zzz = 2;
8: }
9:
10: $o = new x;
11: $o->z = 1000;
12: $o->zzz = 3;
13:
14: var_dump($h = new reflectionproperty($o, 'z'));
15: var_dump($h->isDefault());
16: var_dump($h->isPublic());
17: var_dump($h->isStatic());
18: var_dump($h->getName());
19: var_dump(Reflection::getModifierNames($h->getModifiers()));
20: var_dump($h->getValue($o));
21:
22: print "---------------------------\n";
23: try {
24: var_dump(new reflectionproperty($o, 'zz'));
25: } catch (Exception $e) {
26: var_dump($e->getMessage());
27: }
28:
29: var_dump(new reflectionproperty($o, 'zzz'));
30:
31: class test {
32: protected $a = 1;
33: }
34:
35: class bar extends test {
36: public function __construct() {
37: $this->foobar = 2;
38: $this->a = 200;
39:
40: $p = new reflectionproperty($this, 'foobar');
41: var_dump($p->getValue($this), $p->isDefault(), $p->isPublic());
42: }
43: }
44:
45: new bar;
46:
47: ?>
48: ===DONE===
49: --EXPECTF--
50: object(ReflectionProperty)#%d (2) {
51: ["name"]=>
52: string(1) "z"
53: ["class"]=>
54: string(1) "x"
55: }
56: bool(false)
57: bool(true)
58: bool(false)
59: string(1) "z"
60: array(1) {
61: [0]=>
62: string(6) "public"
63: }
64: int(1000)
65: ---------------------------
66: string(30) "Property x::$zz does not exist"
67: object(ReflectionProperty)#%d (2) {
68: ["name"]=>
69: string(3) "zzz"
70: ["class"]=>
71: string(1) "x"
72: }
73: int(2)
74: bool(false)
75: bool(true)
76: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>