Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77679 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8720 invoked from network); 26 Sep 2014 15:32:49 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2014 15:32:49 -0000 Authentication-Results: pb1.pair.com smtp.mail=patrick.allaert@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=patrick.allaert@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.46 as permitted sender) X-PHP-List-Original-Sender: patrick.allaert@gmail.com X-Host-Fingerprint: 209.85.218.46 mail-oi0-f46.google.com Received: from [209.85.218.46] ([209.85.218.46:40171] helo=mail-oi0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/E0-02658-F1785245 for ; Fri, 26 Sep 2014 11:32:48 -0400 Received: by mail-oi0-f46.google.com with SMTP id x69so3449951oia.5 for ; Fri, 26 Sep 2014 08:32:44 -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:date:message-id:subject :from:to:cc:content-type; bh=cJNTLkQZM/RnzOBFC7eGYwbDIFaAmx3TDXV0yu+l3fg=; b=jKxYz99yKYstfh2BqmSt9tmeEJDGD8IdT79GT9BZa5qh9M97mySWKzzlVuZn+3Iow4 +/QDzX9f4w4peyMk2ohTYdxKGse95D69K6UAKuzRsqvuIXUgNeucORSwoQ/mz2g2Q9u1 fNN/sndBAl8HaM/D/xu8Cun8njg9BGJrHH6VpVa6o70CJSaBUGRloU+9vWkbPyy8/26R 4+dwiUV/HoHnxYuKNbKSnc9IDu4KsHyDDlcFLzzQTx6k0aTuEdyJKzVi5/aaupA3fxCS q8Rp9FVxT0UefuMeFGdJi8zem06NAbkM8XZ8R15L1gtnOkFPgSEd23jP46p8sfi2Zr5Q Drzg== MIME-Version: 1.0 X-Received: by 10.60.173.73 with SMTP id bi9mr22588661oec.24.1411745562289; Fri, 26 Sep 2014 08:32:42 -0700 (PDT) Sender: patrick.allaert@gmail.com Received: by 10.76.155.138 with HTTP; Fri, 26 Sep 2014 08:32:42 -0700 (PDT) In-Reply-To: References: Date: Fri, 26 Sep 2014 17:32:42 +0200 X-Google-Sender-Auth: iSBEbsP3qhsKlHbi8xALVEkFCcE Message-ID: To: Dmitry Stogov Cc: PHP Internals Content-Type: multipart/alternative; boundary=047d7b6736bec0f0530503f9a015 Subject: Re: [PHP-DEV] [VOTE] Fix list() behavior inconsistency From: patrickallaert@php.net (Patrick ALLAERT) --047d7b6736bec0f0530503f9a015 Content-Type: text/plain; charset=UTF-8 2014-09-25 17:27 GMT+02:00 Patrick ALLAERT : > 2014-09-25 9:42 GMT+02:00 Dmitry Stogov : > >> Hi, >> >> The vote is opened at >> https://wiki.php.net/rfc/fix_list_behavior_inconsistency >> >> Thanks. Dmitry. >> > > Hi, > > I'm in favor of disabling for consistency as well, however, I wish a > warning would be emitted. > Not only it would tell me that I have a potential error while upgrading to > PHP 7 but also if I am using it incorrectly, which is always the case when > using a scalar value. > > I therefor propose that: > list($a, $b) = 42; > list($a, $b) = "42"; > list($a, $b) = null; > ... > generates a warning like: PHP Warning: list() expects right operand to be > array, given in on line > > Currently, all of the above lines wouldn't generate any notice / warning / > error, however, using: > list($a, $b) = []; > > generates the following notices: > PHP Notice: Undefined offset: 1 in ... on line ... > PHP Notice: Undefined offset: 0 in ... on line ... > > This is confusing since (to me) using an array is at least better than > using scalars. > > Patrick > bump ? (It is ok to say it's a stupid idea or that I just don't know what I am talking about) Patrick --047d7b6736bec0f0530503f9a015--