xref: /PHP-7.0/Zend/tests/bug45862.phpt (revision 317b48f3)
1--TEST--
2Bug #45862 (get_class_vars is inconsistent with 'protected' and 'private' variables)
3--FILE--
4<?php
5
6class Ancestor {
7  function test() {
8    var_dump(get_class_vars("Tester"));
9    var_dump(Tester::$prot);
10  }
11}
12
13class Tester extends Ancestor {
14  static protected $prot = "protected var";
15  static private $priv = "private var";
16}
17
18class Child extends Tester {
19  function test() { var_dump(get_class_vars("Tester")); }
20}
21
22echo "\n From parent scope\n";
23$parent = new Ancestor();
24$parent->test();
25echo "\n From child scope\n";
26$child = new Child();
27$child->test();
28
29?>
30--EXPECT--
31
32 From parent scope
33array(1) {
34  ["prot"]=>
35  string(13) "protected var"
36}
37string(13) "protected var"
38
39 From child scope
40array(1) {
41  ["prot"]=>
42  string(13) "protected var"
43}
44