Re: Undefined constants producing E_NOTICE

From: Date: Sat, 20 Dec 2008 11:25:49 +0000
Subject: Re: Undefined constants producing E_NOTICE
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-42359@lists.php.net to get a copy of this message
Hi Kuba,
For the moment some unexpected behaviour caused by use of undefined constant may be hard to fix with low error reporting level.
So don't use a low error reporting level. Moreover,
treating an undefined constant as a string does not make sense. I know that PHP is intended to be a flexible language, but for me it's a bit thick.
Just how is PHP supposed to know that some random string is intended to be anything else?
By the quotes :). Undefined variable $foo doesn't fall back to string 'foo' it falls back to null. It's a sane strategy for constants as well. I have no information how people "rely" on this, I know the reason for this fallback is bad syntax like: echo $hi[there]; I'd fix it in 6.0 though. Regards, Stan Vassiev

« previous php.internals (#42359) next »