[RFC] Deprecate and Remove Bareword (Unquoted) Strings
| From: | Rowan Collins | Date: | Sun, 29 Jan 2017 19:33:22 +0000 |
| Subject: | [RFC] Deprecate and Remove Bareword (Unquoted) Strings | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-98025@lists.php.net to get a copy of this message | ||
Good evening all!
Currently, if the constant FROB_ACTIVE is not defined, the code "echo FROB_ACTIVE;" results in an E_NOTICE and the string 'FROB_ACTIVE' being displayed. I would like to propose that this be changed to an E_WARNING in PHP 7.2, and to an Error in PHP 8.0.
My reasoning for this includes:
- consistency with other "undefined" errors, including the otherwise identical "echo \FROB_ACTIVE;"
- the fallback to string appears to be largely undocumented except to discourage its use
- the error can mask serious bugs, such as when mis-typing keywords
I have tried to anticipate some of the questions that will be raised, so have drafted an RFC rather than trying to fit all the detail into one e-mail: https://wiki.php.net/rfc/deprecate-bareword-strings
Please read my proposal, and let me know your thoughts. I have placed the RFC "under discussion", but will be happy to modify it based on feedback, and am in no haste to put it to a vote.
Regards,
--
Rowan Collins
[IMSoP]