Re: [RFC] Warnings for PHP 8.5
| From: | Gina P. Banyard | Date: | Fri, 18 Jul 2025 13:00:58 +0000 |
| Subject: | Re: [RFC] Warnings for PHP 8.5 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-128108@lists.php.net to get a copy of this message | ||
On Tuesday, 15 July 2025 at 20:42, Rob Landers <rob@bottled.codes> wrote:
> Hi Gina, I feel like destructuring
null should not be the same
> warning as other types since null auto-vivicates? to [] (an empty array). Instead, it should provide
> the same warning as https://3v4l.org/8QPiD.
Autovivification is only about write operations, not read.
Therefore, I don't really understand that argument because destructuring is a read operation,
and reading an offset on null emits:
> Trying to access array offset on null
(see https://3v4l.org/sMkCD#vnull)
Which is the same wording as the warning when reading an offset on a scalar:
> Warning: Trying to access array offset on int
As such, they should have the same warning here as well.
Best regards,
Gina P. Banyard