xref: /PHP-5.4/ext/reflection/tests/bug39067.phpt (revision 30a8d14f)
1--TEST--
2Bug #39067 (getDeclaringClass() and private properties)
3--FILE--
4<?php
5
6class A {
7	private $x;
8}
9
10class B extends A {
11	private $x;
12}
13
14class C extends B {
15	private $x;
16}
17
18$rc = new ReflectionClass('C');
19var_dump($rc->getProperty('x')->getDeclaringClass()->getName());
20
21$rc = new ReflectionClass('B');
22var_dump($rc->getProperty('x')->getDeclaringClass()->getName());
23
24$rc = new ReflectionClass('A');
25var_dump($rc->getProperty('x')->getDeclaringClass()->getName());
26
27class Test {
28	private $x;
29}
30
31class Test2 extends Test {
32	public $x;
33}
34
35$rc = new ReflectionClass('Test2');
36var_dump($rc->getProperty('x')->getDeclaringClass()->getName());
37
38echo "Done\n";
39?>
40--EXPECTF--
41string(1) "C"
42string(1) "B"
43string(1) "A"
44string(5) "Test2"
45Done
46