[php-src] Issue #7825: Add nullsafe call and index access
| From: | KapitanOczywisty | Date: | Fri, 15 Apr 2022 12:21:35 +0000 |
| Subject: | [php-src] Issue #7825: Add nullsafe call and index access | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-240996@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/7825
Comment Author: KapitanOczywisty
> 1. How do we handle undefined indexes?
With
$foo?.['bar'] it should only return null if $foo is null,
nothing more, nothing less (exactly like ?->). This is the problem with
?? that it silences more than one kind of errors.
> 2. What about evaluation order of offset expressions?
Preferably it should short-circuit the same way ?-> does as of 8.1.2 https://3v4l.org/4tgX7
Inconsistency between ?-> and ?[...] would be confusing, so just keep
the same way.
> Over all, I'm not super convinced this is worthwhile, since ??}Ξ
> FW˜wû'�•i�Ð already does the job quite well.
It's working, but since silences many errors, it allows for pretty stupid stuff to pass
unnoticed. ?[...] would have only one error to silence.