|
Posted by ljb on 04/25/07 01:39
stereofrog@gmail.com wrote:
> On 24.04.2007 02:49 ljb wrote:
>> I was a bit surprised to find that indexing some non-arrays as if they were
>> arrays does not even raise a Notice message. This works for NULL, integer,
>> and floats at least. (PHP-5.2.1)
>> ...
>>
>> I actually find this behavior useful, but I don't like depending on what
>> seems to be a quirk.
>
> this is the way it's coded in zend engine: reading indexed access to
> scalars returns null. I agree that this behaviour is confusing, and it
> doesn't seem to be documented. Did you consider filing a bug at php.net?
What do you think, report it as a documentation bug (it works the way it
should, but should be documented as such), or as an implementation bug (it
should raise a notice or warning when you try to index NULL or a scalar)?
Although I kind of like the way it works, I don't think it is right.
[Back to original message]
|