On 23 November 2011 15:31, Daniel Convissor
<dani...@analysisandsolutions.com> wrote:
> Hi Again Folks:
>
> On Wed, Nov 23, 2011 at 09:14:09AM -0500, Daniel Convissor wrote:
>> $a = 'foo';
>> echo $a['blah'] . "\n";
>>
>> But that second one echos out "f".  This is a huge WTF.
>
> Two things for the record on this front.  First, i've been actively
> using PHP for, what, ten years or so, and have never run into this
> behavior before.  Second, this behavior turns the following one liner:
>
>        if (isset($arr['package']['attribs']['version'])) {
>
> Into this:
>
>        if (is_array($arr)
>                && array_key_exists('package', $arr)
>                && is_array($arr['package'])
>                && array_key_exists('attribs', $arr['package'])
>                && is_array($arr['package']['attribs'])
>                && array_key_exists('version', $arr['package']['attribs'])
>                && !empty($arr['package']['attribs']['version']))
>        {

I agree with Daniel on this.


Just looking for any test relating to isset() to see what tests will now fail.

Neither of the isset() tests ext/standard/tests/general_functions look
at arrays with associative indices.

The behaviour with regard to unavailable associative indices has no tests.

But using loose typing as a fallback for non existent keys seems
really really wrong.

Especially if the key is a constant. On what planet should ...

isset($arr['exists']['test_existance']) should become isset($arr['exists'][0])

That just seems really wrong and the work around is awful.
-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc : Fantasy Shopper
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea :
fan.sh/6/370

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

Reply via email to