xref: /PHP-7.1/Zend/tests/bug45862.phpt (revision 113213f0)
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 From parent scope
32array(1) {
33  ["prot"]=>
34  string(13) "protected var"
35}
36string(13) "protected var"
37
38 From child scope
39array(1) {
40  ["prot"]=>
41  string(13) "protected var"
42}
43