Re: [RFC] [Discussion] Arrays starting with a negative index
| From: | Pedro Magalhães | Date: | Mon, 26 Feb 2018 17:25:37 +0000 |
| Subject: | Re: [RFC] [Discussion] Arrays starting with a negative index | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101935@lists.php.net to get a copy of this message | ||
On Mon, Feb 26, 2018 at 1:05 PM, Nikita Popov <nikita.ppv@gmail.com> wrote:
>
>
> I like the change, but I'm concerned about the technical impact that
> deprecation notice will have. An error handler can convert the notice into
> an exception, which means that zend_hash_next_index_insert is now going
> to be a throwing operation. Apart from the fact that the currently linked
> implementation is not exception-safe (if the deprecation notice throws, the
> element is still inserted), it's quite likely that at least some of the
> >250 uses of zend_hash_next_index_insert will not deal with exceptions
> correctly.
>
> Nikita
>
Hi Nikita, thanks for the feedback.
About the implementation of the deprecation notice, I agree that it should
be updated to be exception-safe.
About the issue if it being dealt with correctly everywhere, I'm honestly
more inclined towards dealing with it when/if it becomes a problem. I think
the number of users that 1) Start an array with a negative number, 2) Use
implicit keys afterwards and 3) Promote Notices to Exceptions must be a
very very small subset. Would you consider this an acceptable approach for
this specific case?
Thanks,
Pedro