Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62716 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24909 invoked from network); 3 Sep 2012 09:35:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Sep 2012 09:35:56 -0000 Authentication-Results: pb1.pair.com header.from=laruence@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=laruence@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.42 as permitted sender) X-PHP-List-Original-Sender: laruence@gmail.com X-Host-Fingerprint: 209.85.212.42 mail-vb0-f42.google.com Received: from [209.85.212.42] ([209.85.212.42:55798] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/B0-20751-BF974405 for ; Mon, 03 Sep 2012 05:35:55 -0400 Received: by vbbfs19 with SMTP id fs19so5556099vbb.29 for ; Mon, 03 Sep 2012 02:35:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=ZoCwfDPwbnUjLzDGfk30XrfEyRtHyqCcK5vGUhyywkU=; b=E0OG0qPaDV3DHChX/YsCCE8EJ4VymuCb0Acbk9G4XKtM0tgiHLR8OAx0K6nBgPp+YI o5AYqPRxjdNyxshA38uE+5X7VALqGwZ903GirPuT0tKOhKcbRDeZGB3QGPPAQ5S4kEzP tYd5W4oKvQqPx11ZCGJKGelLmTwOTrzfiVoQEc7I0Guf8oreWCBkVbls1Br6DiLZZoIn Ubp9QsdEIfnRbvqYW/b58w1GUkLJeD46NYKBw7KYz3Hnv3lUiHDvLzG1vvzXUnJtoUf+ h2Ag16O/dLYl3NkFPJfHhxaHP8vzofBSNYQY+wy8LSL8I/qsD0C207MC/DrfiHDBHUeT 1jRg== Received: by 10.58.2.232 with SMTP id 8mr12286779vex.45.1346664952950; Mon, 03 Sep 2012 02:35:52 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.18.15 with HTTP; Mon, 3 Sep 2012 02:35:32 -0700 (PDT) In-Reply-To: References: <20120902230741.TSGJ23973.aamtaout03-winn.ispmail.ntl.com@p2> Date: Mon, 3 Sep 2012 17:35:32 +0800 X-Google-Sender-Auth: m-PNNM5CUGFFty-tvh4CpQ9uRcs Message-ID: To: Pierre Joye Cc: Derick Rethans , Jared Williams , internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Foreach list behaviour From: laruence@php.net (Laruence) On Mon, Sep 3, 2012 at 5:28 PM, Pierre Joye wrote: > 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. Hi: if we fixed this, what about following example: > Cheers, > -- > Pierre > > @pierrejoye -- Laruence Xinchen Hui http://www.laruence.com/