Annotation of embedaddon/php/ext/reflection/tests/bug45139.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #45139 (ReflectionProperty returns incorrect declaring class)
3: --FILE--
4: <?php
5:
6: class A {
7: private $foo;
8: }
9:
10: class B extends A {
11: protected $bar;
12: private $baz;
13: private $quux;
14: }
15:
16: class C extends B {
17: public $foo;
18: private $baz;
19: protected $quux;
20: }
21:
22: $rc = new ReflectionClass('C');
23: $rp = $rc->getProperty('foo');
24: var_dump($rp->getDeclaringClass()->getName()); // c
25:
26: $rc = new ReflectionClass('A');
27: $rp = $rc->getProperty('foo');
28: var_dump($rp->getDeclaringClass()->getName()); // A
29:
30: $rc = new ReflectionClass('B');
31: $rp = $rc->getProperty('bar');
32: var_dump($rp->getDeclaringClass()->getName()); // B
33:
34: $rc = new ReflectionClass('C');
35: $rp = $rc->getProperty('bar');
36: var_dump($rp->getDeclaringClass()->getName()); // B
37:
38: $rc = new ReflectionClass('C');
39: $rp = $rc->getProperty('baz');
40: var_dump($rp->getDeclaringClass()->getName()); // C
41:
42: $rc = new ReflectionClass('B');
43: $rp = $rc->getProperty('baz');
44: var_dump($rp->getDeclaringClass()->getName()); // B
45:
46: $rc = new ReflectionClass('C');
47: $rp = $rc->getProperty('quux');
48: var_dump($rp->getDeclaringClass()->getName()); // C
49:
50: ?>
51: --EXPECT--
52: string(1) "C"
53: string(1) "A"
54: string(1) "B"
55: string(1) "B"
56: string(1) "C"
57: string(1) "B"
58: string(1) "C"
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>