Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77629 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79721 invoked from network); 25 Sep 2014 15:27:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Sep 2014 15:27:08 -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.213.175 as permitted sender) X-PHP-List-Original-Sender: patrick.allaert@gmail.com X-Host-Fingerprint: 209.85.213.175 mail-ig0-f175.google.com Received: from [209.85.213.175] ([209.85.213.175:61763] helo=mail-ig0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2D/C1-00789-B4434245 for ; Thu, 25 Sep 2014 11:27:07 -0400 Received: by mail-ig0-f175.google.com with SMTP id h18so8691692igc.2 for ; Thu, 25 Sep 2014 08:27:04 -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=RFqzyDD7PXgxMie+CwX5pAYD8Vfvm7OnOD7VtIfohfM=; b=Mu9zCWLAJPFxJHY8C/uuIQyfhgmGPC3F/V4m2wETMxDV01b3w5blGG2uvK9Cu/ZOZn e4Ed8XbS8Je5odszgz7azNplb5GzXlTm4Wb4Igmwn4Cs7oM9bzWy576SvFFKvaR+CN3T MUCqvU6DNqCFx3IxyeJ4mcXNjcvZ3s5rLhgIfk3FHnzQiYgPCX4jIgLQ/CwqHSDf/xh+ qdgPjMc9bUj+C79rj5itlUX8p29o7LjCz1HlpN8TNUGjLsHv6s65ldpYQeBdSoRxz5hM QlE7d2mT0pxqmv3dRfI22uWdMlw+7h04zO1RZnGFIQ+LGpPpmXSuwkb7eQ3NO1OyRzda g3aQ== MIME-Version: 1.0 X-Received: by 10.42.161.198 with SMTP id u6mr20113688icx.31.1411658824689; Thu, 25 Sep 2014 08:27:04 -0700 (PDT) Sender: patrick.allaert@gmail.com Received: by 10.64.74.225 with HTTP; Thu, 25 Sep 2014 08:27:04 -0700 (PDT) In-Reply-To: References: Date: Thu, 25 Sep 2014 17:27:04 +0200 X-Google-Sender-Auth: gySGkbjfO059_poQSX97FHTVHfo Message-ID: To: Dmitry Stogov Cc: PHP Internals Content-Type: multipart/alternative; boundary=90e6ba6e8fb8ca31750503e56e17 Subject: Re: [PHP-DEV] [VOTE] Fix list() behavior inconsistency From: patrickallaert@php.net (Patrick ALLAERT) --90e6ba6e8fb8ca31750503e56e17 Content-Type: text/plain; charset=UTF-8 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 --90e6ba6e8fb8ca31750503e56e17--