Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62711 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14857 invoked from network); 3 Sep 2012 08:20:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Sep 2012 08:20:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=derick@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=derick@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 82.113.146.227 as permitted sender) X-PHP-List-Original-Sender: derick@php.net X-Host-Fingerprint: 82.113.146.227 xdebug.org Linux 2.6 Received: from [82.113.146.227] ([82.113.146.227:56280] helo=xdebug.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5D/04-25891-53864405 for ; Mon, 03 Sep 2012 04:20:05 -0400 Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id E515010D5C3; Mon, 3 Sep 2012 09:20:01 +0100 (BST) Date: Mon, 3 Sep 2012 09:20:01 +0100 (BST) X-X-Sender: derick@whisky.home.derickrethans.nl To: Laruence cc: Jared Williams , internals@lists.php.net In-Reply-To: Message-ID: References: <20120902230741.TSGJ23973.aamtaout03-winn.ispmail.ntl.com@p2> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] Foreach list behaviour From: derick@php.net (Derick Rethans) On Mon, 3 Sep 2012, Laruence wrote: > On Mon, Sep 3, 2012 at 7:07 AM, Jared Williams wrote: > > > > Just looking at the foreach list behaviour and it does this... > > > > $i = [1, 2, 3]; > > foreach($i as list($a, $b)) > > var_dump($a, $b); > > > > Outputs.... > > > > NULL > > NULL > > NULL > > NULL > > NULL > > NULL > > > > There is no test I can see covering this, so cannot tell if its > > expected. > > > > To me, $i does not meet the expected format, so should be some sort of > > error happening. > > this is expected behavior, like: > list($a, $b) = 1; > var_dump($a); Ew, that's quite nasty (in both cases). Is there a way how we could turn those into a notice or so? cheers, Derick -- http://derickrethans.nl | http://xdebug.org Like Xdebug? Consider a donation: http://xdebug.org/donate.php twitter: @derickr and @xdebug Posted with an email client that doesn't mangle email: alpine