On Sat, Mar 12, 2016 at 8:01 AM, Nikita Popov <nikita....@gmail.com> wrote:
>     class Foo {}
>     new Foo(print 'xyz');
>
> will not print "xyz", because the arguments to "new" are not evaluated if
> the class has no constructor. Conversely
>
I recall someone once dubbing this "The Rasmus Optimization".  I don't
know if that means it was intentional, or just a lazy jibe, but yeah.
It's a long known issue, so it's probably good that you posted about
it first, as someone may have a legit reason for not wanting to fix
it. (I don't, I regard this as a php sadness)

> HHVM does not implement "new" in this way, they always evaluate the arguments.
>
Which, if it helps, means that we already know a lot of frameworks
/don't/ break as a result of fixing this behavior.

> As this is technically a BC affecting change (even if of the lowest
> impact), I'm running it past the list first.
>
Technically a BC break that justifies waiting till a major version.
Given the extremely specific requirements to hit this edge case
however, passing side-effect args to a non-existent constructor, I
personally think a minor version is fine.

+1 (without having looked at the patch)

-Sara

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

Reply via email to