Hi Stas:

> It's actually very simple. Take variable $a which is a string
> ("foo"). Now it you do $a[0] that would produce first letter - "f".
> Now here's a tricky part - if you do $a['blah'] it would convert
> 'blah' to number, get 0 and return the same letter "f".

To me, this is the bug.  $a['blah'] does not exist.  An undefined index
notice should be raised.  The key "blah" should not be converted to 0.
The following two things should behave the same:

$b = array('exists' => 'foo');
echo $b['blah'] . "\n";

$a = 'foo';
echo $a['blah'] . "\n";

But that second one echos out "f".  This is a huge WTF.

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