On 05/04/2021 20:51, André Hänsel wrote:
Note that in that bug entry the solution was based on the premise that `$obj = new 
$foo->bar();` was valid code, which
it isn't. (https://3v4l.org/lpN1T)


Looking at the error message, that code parsed as valid, but failed at run-time, because it was looking for a property $bar, not a method bar(). Working version: https://3v4l.org/S9gLf

It's equivalent to:

$className = $foo->bar;
$obj = new $className();


I think this means that just changing the operator precedence would be a compatibility break, and we would need to allow a more restricted version, as discussed on that feature request.

Regards,

--
Rowan Tommins
[IMSoP]

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

Reply via email to