Re: Raising the precedence of the new operator

From: Date: Mon, 05 Apr 2021 20:10:09 +0000
Subject: Re: Raising the precedence of the new operator
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-113965@lists.php.net to get a copy of this message
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]

« previous php.internals (#113965) next »