Req #65274 [Asn->Csd]: Enhance undefined class constant error with class name
| From: | nikic@php.net | Date: | Wed, 08 Jan 2020 13:18:54 +0000 |
| Subject: | Req #65274 [Asn->Csd]: Enhance undefined class constant error with class name | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-224775@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65274&edit=1
ID: 65274
Updated by: nikic@php.net
Reported by: RQuadling at GMail dot com
Summary: Enhance undefined class constant error with class
name
-Status: Assigned
+Status: Closed
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: n/a
PHP Version: 5.4.17
Assigned To: nikic
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=ae5d7604f699dac4fd824e594c7df5439a36c29b
Log: Fix #65274: Add class name to undef class constant error
Previous Comments:
------------------------------------------------------------------------
[2013-07-16 15:47:24] RQuadling at GMail dot com
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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65274&edit=1