|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-07-16 16:19 UTC] laruence@php.net
-Assigned To:
+Assigned To: laruence
[2017-10-24 08:02 UTC] kalle@php.net
-Status: Assigned
+Status: Open
-Assigned To: laruence
+Assigned To:
[2020-01-03 16:23 UTC] nikic@php.net
-Assigned To:
+Assigned To: nikic
[2020-01-08 13:17 UTC] nikic@php.net
-Summary: Enhance fatal error with class name.
+Summary: Enhance undefined class constant error with class
name
[2020-01-08 13:18 UTC] nikic@php.net
[2020-01-08 13:18 UTC] nikic@php.net
-Status: Assigned
+Status: Closed
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 02:00:01 2025 UTC |
Description: ------------ When reporting that a class constant is undefined, the error message is only half useful in that it doesn't say which class is missing the constant. Whilst I can accept that the constant may be present somewhere in the class structure, the calling class name would aid in the error. Test script: --------------- <?php class A{ const NAME = 'A valid class'; } class B{ } foreach(array('A','B') as $s_ClassName){ echo $s_ClassName::NAME, PHP_EOL; } Expected result: ---------------- A valid class PHP Fatal error: Undefined class constant 'NAME' for class 'B' in - on line 6 Actual result: -------------- A valid class PHP Fatal error: Undefined class constant 'NAME' in - on line 6