Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56516 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43057 invoked from network); 23 Nov 2011 15:40:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2011 15:40:29 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.42 as permitted sender) X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.216.42 mail-qw0-f42.google.com Received: from [209.85.216.42] ([209.85.216.42:61557] helo=mail-qw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2A/B7-31179-CE31DCE4 for ; Wed, 23 Nov 2011 10:40:28 -0500 Received: by qabg40 with SMTP id g40so2759460qab.8 for ; Wed, 23 Nov 2011 07:40:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=IP8Ra2kya8iCp5fuBkyhcETkWVoxtYYpvnSL5Oh8BQM=; b=OTYbkX5aqPdWYf97lwgstvEHm3fNkBV0GZ7PsDiuvu9kOxRb9AaFn+KO1DKmYUWuFL NgfwQKmpBfNL6IlI7HVWvk/Ujzf7wvc/gJIXVcLnR6EDVIL2ZUzfobJ/qVhCF2MrG6yH aT/dg2pdqmA06s00kMu2EKl51Qm3QYMTASvD8= MIME-Version: 1.0 Received: by 10.224.184.143 with SMTP id ck15mr1432087qab.22.1322062825570; Wed, 23 Nov 2011 07:40:25 -0800 (PST) Received: by 10.229.38.134 with HTTP; Wed, 23 Nov 2011 07:40:25 -0800 (PST) In-Reply-To: <20111123153100.GB13420@panix.com> References: <20111123015008.GA12933@panix.com> <20111123023108.GA172@panix.com> <4ECCB549.904@lsces.co.uk> <4ECCBC56.3050602@sugarcrm.com> <20111123141408.GA11940@panix.com> <20111123153100.GB13420@panix.com> Date: Wed, 23 Nov 2011 16:40:25 +0100 Message-ID: To: Daniel Convissor Cc: Stas Malyshev , PHP internals Content-Type: multipart/alternative; boundary=20cf30334fb516c30604b268bd74 Subject: Re: [PHP-DEV] 5.4 regression: non-existent sub-sub keys now have values From: tyra3l@gmail.com (Ferenc Kovacs) --20cf30334fb516c30604b268bd74 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Nov 23, 2011 at 4:31 PM, Daniel Convissor < danielc@analysisandsolutions.com> wrote: > Hi Again Folks: > > On Wed, Nov 23, 2011 at 09:14:09AM -0500, Daniel Convissor wrote: > > $a =3D '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'])) > { > it is only necessary if you can't guarantee your data structure (so that you can get a string where you expect an array) --=20 Ferenc Kov=C3=A1cs @Tyr43l - http://tyrael.hu --20cf30334fb516c30604b268bd74--