On Tue, May 6, 2014 at 6:50 PM, Levi Morrison <morrison.levi@gmail.com>wrote:
>
> On Tue, May 6, 2014 at 8:46 AM, Dmitry Stogov <dmitry@zend.com> wrote:
>>
>> On Tue, May 6, 2014 at 5:11 PM, Levi Morrison <levim@php.net> wrote:
>>
>>> On Tue, May 6, 2014 at 6:43 AM, Dmitry Stogov <dmitry@zend.com> wrote:
>>>
>>>> zend_std_has_dimension() doesn't know what (check_empty == 2) means.
>>>>
>>>> check_empty == 0 - ISSET => we don't need to call offsetGet() and relay
>>>> on
>>>> offsetExists() return value.
>>>> check_empty == 1 - ISEMPTY => we should call offsetGet() after
>>>> offsetExists().
>>>>
>>>> NULL values should be handled by offsetExists().
>>>>
>>>
>>> I am a bit curious, isset checks that the variable exists and is not
>>> null; empty checks that the variable exists and is not empty. Why does
>>> one call offsetGet and not the other? Both look at the value.
>>>
>>> Sorry if I missed that bit of conversation.
>>>
>>
>> yeah, no problem :)
>> I also, don't talk that my opinion is completely right.
>>
>> I think that we make us and users more and more troubles with this messy
>> behavior.
>>
>> Actually, you introduced new behavior (NULL check) and broke at least ZF2
>> and probably many based on it applications.
>>
>
> That isn't any new behavior, at least it shouldn't be. isset does not
> ONLY check existence, it checks that the value is not null; see
> http://php.net/isset
>
I know :), but we never did it for magic handlers. In case offsetExists()
ot __isset() returned "flase" we didn't try to check the value.
>
> It leads to crash and it'll make bad php experience.
>> Then someone will report it as a security problem and we all will be
>> blamed :(
>> We shouldn't make existing applications crash!
>>
>
> Agreed, but at least from what I understand the current behavior doesn't
> do what it is supposed to anyway. Sometimes bugs become features but I
> really don't see this as one of those. We should fix this. That's my $0.02.
>
I would be very glad to have it fixed.
Thanks. Dmitry.