On 05/24/2016 09:54 AM, Stanislav Malyshev wrote:
Hi!
Please review the RFC.
It proposes to fix all known inconsistencies related to handling of special
$this variable.
https://wiki.php.net/rfc/this_var
What is the reason behind all these changes? Does it serve some bigger
purpose?
I started from attempt to eliminate second internal way to access $this
variable.
This disclosed all these inconsistencies.
I'm not sure I currently see a reason to go to all these
lengths. Sure, you can re-assign $this and make things weird. But I
don't see why it's important to prevent it.
Keeping inconsistent behavior isn't good as well.
It seems to add a lot of
code, including checks in various places that would slow down things
(and since these checks need to be done in each and every place we deal
with local variables, it is also a very brittle design - each time we
change or add anything there we'd need to remember forever to include
special case for "this").
Actually, $this may be assigned to local variable in run-time only in 3
places: through $$, extract() and parse_str()/1.
If we remove this checks, we go back to 7.0 behavior - we create a local
variable $this, that has nothing in common with real internal $this
stored in EX(This).
Also notes:
1. How static __call is a thing? That looks like something that makes no
sense at all.
The same for me.
I got to know about static __call() and its special behavior from test
suite. :)
See tests/classes/__call_007.phpt
2. Why get_defined_vars() shouldn't show $this?
In most cases it doesn't show $this in 7.0.
Thanks. Dmitry.