|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-06-09 08:40 UTC] johannes@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 03:00:01 2025 UTC |
Description: ------------ When class variables refers to a constant of the class using self::, get_class_vars produces a fatal error. Note that the code works if I access the class previously (uncomment commented lines in reproduction) Reproduce code: --------------- <?php class foo { const FOO = 1; public $x = self::FOO; } //$b = new foo(); //var_dump($b); var_dump(get_class_vars("foo")); Expected result: ---------------- array(1) { ["x"]=> int(1) } Actual result: -------------- Fatal error: Cannot access self:: when no class scope is active in /root/const2.php on line 9