Hi!
On 11/22/11 6:36 PM, Etienne Kneuss wrote:
PEAR is definitely doing some strange things :) Is it checking indices
of a variables without checking first if it's an array?
Sounds like the comeback of "Please don't break bad code!" seen with is_a :)
I think somebody should start a code cleanup effort :) We can't build
all PHP development around preserving every line of bad code doing bad
things around. We care about BC but there should be some limits, and bug
compatibility is beyond those limits.
We long had array access syntax on strings. Expression $a[0]["foo"]
where $a[0] is a string has long been treated as $a[0][0] and returned
first letter of $a[0] (btw code doing this is already a bug, even though
PHP lets you get away with it - but I'd put some notice there). Since
this letter is a string, it should behave the same as other strings.
Otherwise this code:
echo $a[0]["foo"]["bar"]
and this one:
$b = $a[0]["foo"];
echo $b["bar"];
behave differently, which was a huge WTF and can only be considered a
bug. Any code relying on this should be considered a bug too and fixed
immediately. I can not think of any legitimate reason for the code to
rely on such things.
--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php