Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:62712 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16952 invoked from network); 3 Sep 2012 08:37:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Sep 2012 08:37:01 -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:38002] helo=mail-vb0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 29/64-25891-C2C64405 for ; Mon, 03 Sep 2012 04:37:00 -0400 Received: by vbbfs19 with SMTP id fs19so5510321vbb.29 for ; Mon, 03 Sep 2012 01:36:57 -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=xhtfVl0dA5pkvGh4xxGbJokupXXnyZ2VMuX1rOUwyX0=; b=kdoC6p9UuYRvJFBaCyDsu+pOs+SoLtQuetN5Vf3ImySkUpezONIaP43Xi1RrAs0Dpr L6cYr0dANCfH4wwlCIZRZ1k6P5xYKem5U7mNSNsb4XYrMYy8/j6gP8ISxf3xgG/PvM6K /DVnQqecUuHgpDttv6kVT/jgu2y99jq02A7/eFdSN8/amwumBbqSdV2oiY53nNW6y5P6 6+Z+RzQjk6P4YsCd2C5siVxuWX7UyIvZFuPtMU8y7c6pm8p1nkqmSDo8B6xlNzHsZNpx UMFpB6dGpQWyn0tFKIWrAN/2SlrIvTHUH44Fat2DiJLZm1II8kxSlGkxU+95tUrw9Jzt b/tQ== Received: by 10.52.20.138 with SMTP id n10mr9322874vde.129.1346661417512; Mon, 03 Sep 2012 01:36:57 -0700 (PDT) MIME-Version: 1.0 Sender: laruence@gmail.com Received: by 10.220.18.15 with HTTP; Mon, 3 Sep 2012 01:36:36 -0700 (PDT) In-Reply-To: References: <20120902230741.TSGJ23973.aamtaout03-winn.ispmail.ntl.com@p2> Date: Mon, 3 Sep 2012 16:36:36 +0800 X-Google-Sender-Auth: 5MNCe9Z_gwIDzntURu3AT-ohSYU Message-ID: To: Derick Rethans Cc: 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 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? thanks > > 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 -- Laruence Xinchen Hui http://www.laruence.com/