Re: Raise E_NOTICE for null castings
| From: | Christoph M. Becker | Date: | Fri, 27 Oct 2017 11:47:35 +0000 |
| Subject: | Re: Raise E_NOTICE for null castings | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-100962@lists.php.net to get a copy of this message | ||
On 27.10.2017 at 11:49, Filippo Tessarotto wrote:
> Hi, I would like to propose an RFC to raise an E_NOTICE when a variable
> "initialized" to null is casted to other types:
>
> $foo = null;
> var_dump($foo['bar']);
> var_dump($foo . 'bar');
> var_dump($foo + 2);
> var_dump($foo & 2);
> // At the time being, this code produces no errors
>
> The eventual vote may be split one for each case.
>
> What do you think?
Note that there is already an accepted RFC regarding rasing E_WARNING
for invalid container read array-access[1]. However, it has not been
implemented yet, due to difficulties, see the discussion on PR #2031[2].
[1] <https://wiki.php.net/rfc/notice-for-non-valid-array-container>
[2] <https://github.com/php/php-src/pull/2031>
--
Christoph M. Becker