Re: Proposal: Raise severity of undefined constants
| From: | Rowan Collins | Date: | Wed, 28 Jan 2015 15:42:31 +0000 |
| Subject: | Re: Proposal: Raise severity of undefined constants | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81308@lists.php.net to get a copy of this message | ||
Ferenc Kovacs wrote on 28/01/2015 12:13:
E_DEPRECATED is likely to be even more ignored than E_NOTICE, so
would be a step backwards; my whole assumption is that most people
getting the message are not using a deprecated feature, but
accidentally mis-typing a constant or keyword. I'd be happy with
raising it to E_WARNING to make it more noticeable, though, if we
don't think removing the functionality is acceptable.
turn it into E_WARNING if we are planning to keep the feature, turn it into E_DEPRECATED if we want to remove the feature later on.
I see absolutely no advantage in changing this into E_DEPRECATED, as it's even more likely to be hidden or ignored than E_NOTICE.
There are actually two parts to the message: that you used an undefined constant, and that PHP interpreted this as you wanting a string. If you really intended a string, then "deprecated" is relevant; but if you intended a keyword or constant, then there is nothing to deprecate, it's just an error.
If we want to keep the string fallback for now, how about we raise the severity to E_WARNING, and change the message to mention deprecation?
e.g.
Warning: Use of undefined constant foo - assumed 'foo', but this behaviour will change in a future version
Regards,
--
Rowan Collins
[IMSoP]