Hi Richard,

$this is still confirm to variable syntax. It's just a special variable.
I think, we should keep lexical rules unchanged.

Thanks. Dmitry.


________________________________________
From: Fleshgrinder <p...@fleshgrinder.com>
Sent: Tuesday, May 31, 2016 7:19:57 PM
To: Dmitry Stogov; internals; Nikita Popov
Subject: Re: [PHP-DEV] [RFC] Fix inconsistent behavior of $this variable

On 5/23/2016 10:24 PM, Dmitry Stogov wrote:
> https://wiki.php.net/rfc/this_var
>

Hi Dmitry,

could you extend the RFC with an additional section that mentions to
update corresponding manual pages, e.g.:

https://secure.php.net/language.variables.basics

There is a regular expression on that page that looks like the following
and is often referred to by people explaining variable names in PHP:

  [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*

I would propose to update this to the following more complete PCRE:

  /^\$?(?!this)[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/D

@nikic this is also important for your RFC regarding empty variable
names because the PCRE would need to be updated once more too:

  /^\$?(?!this)[a-zA-Z_\x7f-\xff]?[a-zA-Z0-9_\x7f-\xff]*$/D

Of course the sentence preceding the regular expression would also
require an update.

There might be more pages that I am not aware of but we could ask
someone from the documentation team to help us here. The above one is
definitely the most important one and it should imho be included in the RFC.

--
Richard "Fleshgrinder" Fussenegger


--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to