On 18/11/2014 23:07, Stanislav Malyshev wrote:
Hi!
Are you sure it was intended to work this way, with the parameters
not being evaluated at all?
Of course, just look at how ZEND_NEW opcode is written. It's the only
reason in has op2 there. That code is not a typo, it's intended to skip
the function call.
I don't know the innards of the engine well enough to follow this, but
it sounds like you're talking about skipping the evaluation of
__construct() as a method if it doesn't exist as one, which is perfectly
reasonable.
However, the side effect that the *arguments* to that function call are
not executed is surely an unintended side-effect of this, which was
considered not important enough to worry about.
I personally am not completely sure it's worth the trouble - since,
again, no sane code should ever rely on something like this - but maybe
I'm wrong that there's a valid use case for this.
Sorry, I'm not sure what you are referring to by "this" here. To quote
an earlier example:
$b = 0;
$a = new Foo(++$b);
Looks like pretty normal code to me; no reason to expect anything about
the way class Foo is defined to affect its behaviour.
No sane code should rely on that *not* incrementing $b, surely?
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php