Re: [RFC] Deprecate and Remove Bareword (Unquoted) Strings
| From: | Christoph M. Becker | Date: | Wed, 01 Feb 2017 23:12:43 +0000 |
| Subject: | Re: [RFC] Deprecate and Remove Bareword (Unquoted) Strings | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-98113@lists.php.net to get a copy of this message | ||
On 31.01.2017 at 23:49, Johannes Schlüter wrote:
> On Tue, 2017-01-31 at 23:46 +0100, Johannes Schlüter wrote:
>
>> On Sun, 2017-01-29 at 19:33 +0000, Rowan Collins wrote:
>>> 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.
>>
>> related: There is another context where unquoted strings are used:
>>
>> $a = [ "foo" => "bar" ];
>> echo "Let's go and have a drink in a $a[foo]!";
This is explicitly mentioned in the RFC's "Unaffected PHP Functionality"
section[1]. The RFC suggest to keep this shortcut.
> Oh and there's another case:
>
> foo.php?a[foo]=bar
>
>> Any thoughts about continuing to allow that?
>
> I'm not saying we have to change those. But I believe the symmetry there
> is part of the historic reason.
Okay, but in neither case you've mentioned there are any potential
pitfalls, i.e.
foo can't be mistaken for a constant there, because the
engine expects an unquoted string.
[1]
<https://wiki.php.net/rfc/deprecate-bareword-strings#unaffected_php_functionality>
--
Christoph M. Becker