Hi Stas:

> I am 100% opposed to changing anything there and
> re-breaking string offsets because somebody uses string indexes to
> operate on strings and expect them to work in weird ways that makes
> $a[0][0] work differently from $b = $a[0]; $b[0].

The fix to make $a[0][0] work is good.  No argument here.

The problem arises where programmers wrote code anticipating the
incoming variable is an array but another programmer has passed in a
string.  The inital programmer wrote a validation to see if a sub-sub
key isset/!empty.  If that key wasn't in the array or the array was a
string, the validation fails and appropriate action is taken.  But now
the validation passes and mayhem ensues.


> If you use string
> offsets on strings, expect them to be converted to numbers, it has
> been there since forever and only didn't work on chained offsets
> because of a bug.

This is the first time in ten years I heard about string array keys
being converted to integers (all be it in the context of string
offsets).

If this behavior is going to remain, the conversion is a strong
indicator that unintended behaviors are happening.  We need to follow
the logic of the new array string conversion notice in 5.4 and produce a
notice in this situation so programmers can address the bugs in their
programs rather than being secretly bitten by this bug.

Thanks,

--Dan

-- 
 T H E   A N A L Y S I S   A N D   S O L U T I O N S   C O M P A N Y
            data intensive web and database programming
                http://www.AnalysisAndSolutions.com/
 4015 7th Ave #4, Brooklyn NY 11232  v: 718-854-0335 f: 718-854-0409

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to