<?php
class P{
public $foo;
}
class C extends P {
public $lol;
public function getFields()
{
var_dump(array_keys(get_class_vars(Parent)));
return array_keys(get_class_vars(__CLASS__));
}
}
$c = new C();
var_dump($c->getFields());
Fatal error: Uncaught Error: Undefined constant "Parent" in /in/O3AAD:12
Stack trace:
#0 /in/O3AAD(18): C->getFields()
#1 {main}
thrown in /in/O3AAD on line 12
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: Use of undefined constant Parent - assumed 'Parent' (this will throw an Error in a future version of PHP) in /in/O3AAD on line 12
Warning: array_keys() expects parameter 1 to be array, bool given in /in/O3AAD on line 12
NULL
array(2) {
[0]=>
string(3) "lol"
[1]=>
string(3) "foo"
}
Output for 7.2.0 - 7.2.33
Warning: Use of undefined constant Parent - assumed 'Parent' (this will throw an Error in a future version of PHP) in /in/O3AAD on line 12
Warning: array_keys() expects parameter 1 to be array, boolean given in /in/O3AAD on line 12
NULL
array(2) {
[0]=>
string(3) "lol"
[1]=>
string(3) "foo"
}
Notice: Use of undefined constant Parent - assumed 'Parent' in /in/O3AAD on line 12
Warning: array_keys() expects parameter 1 to be array, boolean given in /in/O3AAD on line 12
NULL
array(2) {
[0]=>
string(3) "lol"
[1]=>
string(3) "foo"
}
Notice: Use of undefined constant Parent - assumed 'Parent' in /in/O3AAD on line 12
Warning: array_keys(): The first argument should be an array in /in/O3AAD on line 12
NULL
array(2) {
[0]=>
string(3) "lol"
[1]=>
string(3) "foo"
}
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/O3AAD on line 4
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/O3AAD on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/O3AAD on line 4
Process exited with code 255.