Re: [RFC] Deprecate and Remove Bareword (Unquoted) Strings
| From: | Nikita Popov | Date: | Sun, 29 Jan 2017 20:50:52 +0000 |
| Subject: | Re: [RFC] Deprecate and Remove Bareword (Unquoted) Strings | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98027@lists.php.net to get a copy of this message | ||
On Sun, Jan 29, 2017 at 8:33 PM, Rowan Collins <rowan.collins@gmail.com>
wrote:
> 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.
>
Fully agree with this proposal.
Also agree with the choice of throwing a Warning instead of a Deprecation.
Throwing a Deprecation would essentially *downgrade* the current error
level, which does not appear to be prudent.
Nikita