mirror of
https://github.com/php/php-src.git
synced 2024-11-25 19:05:31 +08:00
317b48f3af
- Fixed bug #45862 (get_class_vars is inconsistent with 'protected' and 'private' variables) - Added some tests
40 lines
448 B
PHP
40 lines
448 B
PHP
--TEST--
|
|
get_class_vars(): Testing visibility
|
|
--FILE--
|
|
<?php
|
|
|
|
class A {
|
|
protected $a = 1;
|
|
private $b = 2;
|
|
}
|
|
|
|
class B extends A {
|
|
private $c = 3;
|
|
public function __construct() {
|
|
var_dump(get_class_vars('A'));
|
|
var_dump(get_class_vars('B'));
|
|
}
|
|
}
|
|
|
|
var_dump(get_class_vars('A'));
|
|
var_dump(get_class_vars('B'));
|
|
|
|
new B;
|
|
|
|
?>
|
|
--EXPECT--
|
|
array(0) {
|
|
}
|
|
array(0) {
|
|
}
|
|
array(1) {
|
|
["a"]=>
|
|
int(1)
|
|
}
|
|
array(2) {
|
|
["c"]=>
|
|
int(3)
|
|
["a"]=>
|
|
int(1)
|
|
}
|