Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62714 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21937 invoked from network); 3 Sep 2012 09:28:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Sep 2012 09:28:23 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.170 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:62288] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 79/10-20751-73874405 for ; Mon, 03 Sep 2012 05:28:23 -0400 Received: by iamm10 with SMTP id m10so8504506iam.29 for ; Mon, 03 Sep 2012 02:28:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=DyVdmm0IPD0kxkP64SJ4CsGszkAiS1JepWITWoT/0IQ=; b=O1TpPESWE89MwCTzWVCe5GX/f4/lEj6IAxZSXp0QJ07ypyzkUscY/AkW2w7KDduKS1 MkXmvnekk+5XHtaggCmOLmBapVYxPH9QPwJ2AGzNOQC2l4Dtv4LCNDHGlCgCZ1sJq92u 9+QetjqpX7mZwYcgZ8RPENRADNac4oK3Vwp9OcFFhj3Is7I0mjS5/kSzW09/wjZDpIJD K2Eu8hFJD/hCAOX9Hi/9Twq6wh4VhNP9zhAzz2+ooukVH9koyIvu2V8MMY/B5CKkB+gJ B4VA+fb++LZGdOzyQi7kkfNtn14L6jqSth2YQuqdmWwcVELo0j+J+hsQQJBBzxSc1EQL oJPQ== MIME-Version: 1.0 Received: by 10.50.159.130 with SMTP id xc2mr10144710igb.33.1346664499728; Mon, 03 Sep 2012 02:28:19 -0700 (PDT) Received: by 10.64.60.40 with HTTP; Mon, 3 Sep 2012 02:28:19 -0700 (PDT) In-Reply-To: References: <20120902230741.TSGJ23973.aamtaout03-winn.ispmail.ntl.com@p2> Date: Mon, 3 Sep 2012 11:28:19 +0200 Message-ID: To: Laruence Cc: Derick Rethans , Jared Williams , internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Foreach list behaviour From: pierre.php@gmail.com (Pierre Joye) hi, On Mon, Sep 3, 2012 at 10:36 AM, Laruence wrote: > On Mon, Sep 3, 2012 at 4:20 PM, Derick Rethans wrote: >> 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? > Hi: > > yeah, we can trigger a notice if the container is not a array. > > but maybe deserve a RFC? I do not think it is necessary. It is an improvement of this newly added feature and list. Cheers, -- Pierre @pierrejoye