Re: Undefined constants producing E_NOTICE
| From: | Greg Beaver | Date: | Sat, 20 Dec 2008 16:40:31 +0000 |
| Subject: | Re: Undefined constants producing E_NOTICE | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-42361@lists.php.net to get a copy of this message | ||
Cristian Rodríguez wrote:
> Kuba Wieczorek escribió:
>> Hello everyone,
>>
>> Currently when an undefined constant is called, E_NOTICE is produced and
>> the name of the constant is assumed to be a string. In my opinion this
>> behaviour is strange and problematic for most developers. Maybe it would
>> be good if invoking undefined constants will start to produce at least
>> E_WARNING?
>
> Use class constants
>
> class foo {
> }
>
> echo foo::BAR;
>
> Fatal error: Undefined class constant 'BAR' ...
>
> that's what you are really looking for... ;)
namespaced constants also cause fatal error when used with qualified name.
Greg