xref: /PHP-7.2/ext/reflection/tests/bug48336.phpt (revision 5c5dcf5e)
1--TEST--
2Bug #48286 (ReflectionProperty::getDeclaringClass() does not work with redeclared properties)
3--FILE--
4<?php
5class A {
6}
7
8class B extends A {
9  static protected $prop;
10}
11
12class C extends B {
13  static protected $prop;
14}
15
16class D extends C {
17}
18
19class E extends D {
20}
21
22class F extends E {
23  static protected $prop;
24}
25
26$class = 'A';
27for($class = 'A'; $class <= 'F'; $class ++) {
28  print($class.' => ');
29  try {
30    $rp = new ReflectionProperty($class, 'prop');
31    print($rp->getDeclaringClass()->getName());
32  } catch(Exception $e) {
33    print('N/A');
34  }
35  print("\n");
36}
37?>
38--EXPECT--
39A => N/A
40B => B
41C => C
42D => C
43E => C
44F => F
45