On Mon, Oct 19, 2015 at 12:34 PM, Alexander Lisachenko
<lisachenko...@gmail.com> wrote:
> 2015-10-19 12:19 GMT+03:00 Nikita Popov <nikita....@gmail.com>:
>
>> This change is primarily targeting userland methods, so your use-case is
>> exactly the one this is supposed to prevent. Note that you can still use
>> ->bindTo($object). The only thing you cannot do is ->bindTo($object,
>> get_class($object)).
>
>
>
> It's very pity ( It was a very interesting feature that gives a birth for
> userland AOP, without it part of framework functionality *will be lost*.
> From the list of attached bugs I can see that all weird stuff happens only
> with internal classes/functions/methods. I never have seen a segfaults in
> my code that heavily uses closure rebinding with userland methods/classes
> and expect it to work in all future versions of PHP, starting from >=5.4.
>
> I don't know PHP engine well, but this feature with scope rebinding for
> methods allows some interesting patterns, like "Spy", "Field initializer",
> "Lazy proxy initializer", etc. We just take one method and bind it to
> another scope to perform an additional logic if needed.
>
> Maybe, apply your patch only to internal functions (restrict them to have
> $this inside) and simple functions? This will cover most bugs, but won't
> break an exisitng code.

This is very tricky use case IMO.

We should absolutely focus on stability, and if we can't find a way to
make things safe, we forbid them
for the stability sake. If there are no way to have stable things,
well, that's pitty but it's like that.

We can't allow PHP to release with a known crashing behavior.

Perhaps we'll find new ways to do things in 7.1 or next 8.0.


Julien.Pauli

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

Reply via email to