Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101931 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82483 invoked from network); 26 Feb 2018 13:05:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Feb 2018 13:05:29 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.169 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.223.169 mail-io0-f169.google.com Received: from [209.85.223.169] ([209.85.223.169:46349] helo=mail-io0-f169.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/12-60937-816049A5 for ; Mon, 26 Feb 2018 08:05:28 -0500 Received: by mail-io0-f169.google.com with SMTP id p78so17089656iod.13 for ; Mon, 26 Feb 2018 05:05:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=rzpiLr1gATdzmJ5zjD3A/4X7jP9sZ7n0OyEvhfxJ3+A=; b=GSgVkRCq62UWM96QQPUmFafBtg2aeip+iqpLqex9v1y6ruccQH9G+nFVEHaxHmSv79 /bZLYOR12cJrWxipAQelXJMTW+wlCDvzHabOOr3CLHPBcaZdv3ymtwC/u/y4nezh0UBV 7T/7Qfo/C+ggYjrRLU438R5HW6fM53SI2AHEkAh2hmygux2Qgn64YGjoPVjolmoyNPBG WXEOv2KDPVe5tMO5FWePsRo1tm+iWfLhLFBmwjdjqS7Fd+8GrgcxEF8LUyCwPbovymHq ExLvxUCT9+g7N+c4M5LNQFjCa5KXAYk0OsaWEdegS62jc4KZHkhB4kpYFI5EMSQhWGha 6b9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=rzpiLr1gATdzmJ5zjD3A/4X7jP9sZ7n0OyEvhfxJ3+A=; b=X9Z4osCI1MW8E5UjSF7969Z/ZdGx5ESvKc5FvNTr0ayPDusI8x44T3OteYXPXLH8JH QykRrQSQxl781dPWHYX5/m0tb3RAOT6+xgqcX+2jy+1M7FNr5tz755ytHVkvpglftE2v hDKhaHsLXA3HsLXm8c8P/P+Fl9KIBojJrsJfm6gOKdGSafpekg2bdi547FTPpsNJO7MM sdDrcc0QXWkyptyr+xUX8fu0EHrvBs3PPUkWV+e+dyksJZQlSNY6RvidZ+z4JGHyv72W hqa0PxLHe0FtxFEw05br2dlAKLP7BXtukl2u9A+oQjLQ1OB7UqTzkWmxiZHpHChcPFb7 9O7g== X-Gm-Message-State: APf1xPChyIARcRw3sC4hMrekJZJ6ly+i2XPLvJpG1Kiz+ufKAqQMowA9 x6IRQ65keeg3ai5Yv5uusbrCr4UZ0U3dMvVO8Ddk7Q== X-Google-Smtp-Source: AG47ELttNg8MMr0FshIc9vBi7XWaOP2V9VsfsbzJYvVem1mwWSuSFGtwvzZDxlCNCgGrT8IoMOadYHeziOsILnLPUB4= X-Received: by 10.107.14.73 with SMTP id 70mr11397243ioo.258.1519650325685; Mon, 26 Feb 2018 05:05:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.22.1 with HTTP; Mon, 26 Feb 2018 05:05:24 -0800 (PST) In-Reply-To: References: Date: Mon, 26 Feb 2018 14:05:24 +0100 Message-ID: To: =?UTF-8?Q?Pedro_Magalh=C3=A3es?= Cc: PHP internals Content-Type: multipart/alternative; boundary="001a113ff69cd86c5005661d29f7" Subject: Re: [PHP-DEV] [RFC] [Discussion] Arrays starting with a negative index From: nikita.ppv@gmail.com (Nikita Popov) --001a113ff69cd86c5005661d29f7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 13, 2018 at 9:03 PM, Pedro Magalh=C3=A3es wro= te: > Hi internals, > > I want to bring up this RFC once again given that now seems to be the rig= ht > timing for it. I have previously canceled the vote when I initially > proposed this to land on 7.2 which was seen as too big of a BC for a mino= r > version. On a second attempt targeting 8.0 I have also canceled the vote = as > the inclusion of a deprecation notice in cases where the behavior will > change warranted further discussion. > > To address these issues, the current version of the RFC will have 2 > separate votes: > - Introduce the new behavior on 8.0 > - Introduce a deprecation notice on 7.3 > > For those not familiar with the RFC, the general idea is that currently, > any array that has a number n as it's first numeric key will have for it'= s > next implicit key either n+1 if n >=3D 0 or 0 if n < 0. This RFC proposes= to > make this consistent by always using n+1 regardless of the sign of n. > In code: > $a[-2] =3D true; // Current: Key is -2, RFC: Key is -2 > $a[] =3D true; // Current: Key is 0, RFC: Key is -1 > $a[] =3D true; // Current: Key is 1, RFC: Key is 0 > > I invite you to read the full RFC: > https://wiki.php.net/rfc/negative_array_index and bring up any issues you > see with the current version before the voting period starts. > > Looking forward for any feedback. > > Regards, > Pedro Magalh=C3=A3es > I like the change, but I'm concerned about the technical impact that deprecation notice will have. An error handler can convert the notice into an exception, which means that zend_hash_next_index_insert is now going to be a throwing operation. Apart from the fact that the currently linked implementation is not exception-safe (if the deprecation notice throws, the element is still inserted), it's quite likely that at least some of the >250 uses of zend_hash_next_index_insert will not deal with exceptions correctly. Nikita --001a113ff69cd86c5005661d29f7--