Re: Null-safe property access in interpolated strings

From: Date: Mon, 10 Aug 2020 11:02:16 +0000
Subject: Re: Null-safe property access in interpolated strings
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-111421@lists.php.net to get a copy of this message
Hi, On Sun, Aug 9, 2020 at 8:34 PM Jordi Boggiano <j.boggiano@seld.be> wrote: > Can't say I'm big on interpolation but I'd definitely expect this to > work because why not? A reason why not is because it will break backwards compatibility with existing (though admittedly unlikely) code which also can't be fixed by easy search and replace: $foo = "gnegg"; echo "$foo?->bar()" would be fine in PHP < 8 and would blow up with `Uncaught Error: Call to a member function bar() on string` with this change. I'm not saying this is a problem because code like this is unlikely to be written, but it *is* a BC break. Philip

« previous php.internals (#111421) next »