Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56515 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40172 invoked from network); 23 Nov 2011 15:31:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Nov 2011 15:31:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=danielc@analysisandsolutions.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=danielc@analysisandsolutions.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain analysisandsolutions.com from 166.84.1.89 cause and error) X-PHP-List-Original-Sender: danielc@analysisandsolutions.com X-Host-Fingerprint: 166.84.1.89 mailbackend.panix.com Solaris 10 (beta) Received: from [166.84.1.89] ([166.84.1.89:45433] helo=mailbackend.panix.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1A/27-31179-8B11DCE4 for ; Wed, 23 Nov 2011 10:31:05 -0500 Received: from panix5.panix.com (panix5.panix.com [166.84.1.5]) by mailbackend.panix.com (Postfix) with ESMTP id 0206828D04; Wed, 23 Nov 2011 10:31:00 -0500 (EST) Received: by panix5.panix.com (Postfix, from userid 14662) id BEB5C24249; Wed, 23 Nov 2011 10:31:00 -0500 (EST) Date: Wed, 23 Nov 2011 10:31:00 -0500 To: Stas Malyshev Cc: PHP internals Message-ID: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20111123141408.GA11940@panix.com> User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [PHP-DEV] 5.4 regression: non-existent sub-sub keys now have values From: danielc@analysisandsolutions.com (Daniel Convissor) 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'])) { 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