Re: Null-safe property access in interpolated strings
| From: | Ilija Tovilo | Date: | Sun, 09 Aug 2020 18:32:50 +0000 |
| Subject: | Re: Null-safe property access in interpolated strings | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111398@lists.php.net to get a copy of this message | ||
Hi internals
> Do we expect this to work?
>
> $foo = new stdClass;
> $foo->bar = "Hello";
> echo "$foo?->bar world\n";
>
> Because at the moment it doesn't: https://3v4l.org/nLv3l
The patch can be found here:
https://github.com/php/php-src/pull/5966
It adds ~5 lines to the lexer. As mentioned, there is a BC break
although it is probably very small (I could find no code that breaks
on grep.app). Because this BC break was never mentioned in the RFC I'm
leaning towards not merging this patch but I am happy either way.
Let's hear from a few more people what they think until we decide how
to move forward.
Ilija