Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115706 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 6518 invoked from network); 13 Aug 2021 14:18:10 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Aug 2021 14:18:10 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 28253180212 for ; Fri, 13 Aug 2021 07:49:22 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 13 Aug 2021 07:49:18 -0700 (PDT) Received: by mail-pl1-f182.google.com with SMTP id e15so12262297plh.8 for ; Fri, 13 Aug 2021 07:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=InvEIt1qLagjPrdluoUlLpn0iGfTpf9ktKFAH/bvUzQ=; b=VsUCNqtdAKdZr6IlROaZ9z2oWXrvU4umH3ZtAWwMYIZ4ScHpJNlYgqKRfDYYOplpDm lTXalttkc9e2z8yEtMzhcTOgE1ysijYHrB2lo2nPVsj0OTQGyGUyst6YA4SZzKSM9rhy YcqMKXBnr+js0HmLRXK8s9UZW22u6PDUZcq5zDc7AoMaLoSX96ybzz+tihXcs5k6H88h NvL7xcirfFHwKddYenuuUouAYsbaXvm755zWyxGLyXOGMuWKMG2pNTQKs4E39nmIg5lv P+RRAJPUOpQSJmTeX5fBnuIedQXTxSPgfU5qf1hFfsIorUsp1OU92uymCSpQSLDmlQeL 3KGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=InvEIt1qLagjPrdluoUlLpn0iGfTpf9ktKFAH/bvUzQ=; b=HfZB+GWuCIs9Dwv3/NtNG0wV/uYp30PMBJrjIUnpwm0ZzIQ0V0+PsUBzMvVAvZV+sb PWF17/LThOBIkZXAV++KuC1u6BmIktEJZ8jC/hFI4kWLOA/W9to8slm628HC/d+0trIY QtVnym3FyTcjy0DgwG7FtM8mSeQhzT8Qi3g3IvyJ88K3X4T8aJQ+w0BKI32TOCmR2E8K 2ZQFq/cUBKrDAWBWDXaDsfQLpCK2Do6zfZ270pdNfZDGKOlgRdXV/q911BGY0S+ANLOK cV5gb973OktREJfMKH6X5RkmpjDN/0dmzGqMB+FXqyx9L/AFJRp2kNr3LDKPNpgZJLZ7 bWeg== X-Gm-Message-State: AOAM5337l3sa7nqNvvrVGk8D5LCu2r/Ar2wIISnI4kBaZGD8sDWMb0VT xetb11IGSJUVTmOKbYhMqigkgX3jqBgrfFGTukU= X-Google-Smtp-Source: ABdhPJyEJ2/ztjRLd58JrqqzSv3Rt1h3vTUcPGfFMiHntQ7+PyG8jMPbtaG2kVW5KFYCrnmZDIxDqx+5bADtdw3kiEs= X-Received: by 2002:a17:90b:4d82:: with SMTP id oj2mr3024982pjb.192.1628866153572; Fri, 13 Aug 2021 07:49:13 -0700 (PDT) MIME-Version: 1.0 References: <3101FD49-44C8-464A-AF77-1859A51D92EA@gmail.com> In-Reply-To: <3101FD49-44C8-464A-AF77-1859A51D92EA@gmail.com> Date: Fri, 13 Aug 2021 11:49:02 -0300 Message-ID: To: Claude Pache Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary="000000000000786db205c971f41f" Subject: Re: [PHP-DEV] Unwrap reference after foreach From: flaviohbatista@gmail.com (=?UTF-8?Q?Fl=C3=A1vio_Heleno?=) --000000000000786db205c971f41f Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Aug 13, 2021 at 11:20 AM Claude Pache wrote: > > > Le 13 ao=C3=BBt 2021 =C3=A0 15:28, Nikita Popov = a =C3=A9crit : > > > > Hi internals, > > > > I'd like to address a common footgun when using foreach by reference: > > https://wiki.php.net/rfc/foreach_unwrap_ref > > > > This addresses the issue described in the big red box at > > https://www.php.net/manual/en/control-structures.foreach.php. While > this is > > "not a bug" (as our bug tracker can regularly attest), it's rather > > unexpected, and we could easily avoid it... > > > > Regards, > > Nikita > > > Hi, > > I don=E2=80=99t like the split of semantics between simple and complex va= riables. > It makes the language more inconsistent, therefore more difficult to reas= on > about. > > On the other hand, using a complex variable as reference in that context > should be very rare outside obfuscation code contests. > > Therefore, I suggest to deprecate (and later remove) the ability to use o= f > a complex variable as reference in that context. That would solve the > inconsistency issue. > > =E2=80=94Claude > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > Hi, I know I don't have an actual vote (voting karma it is), but it's a +1 from me as well. I like Trevor's suggestion of scoping variables within loops and this would be a first step towards it. --000000000000786db205c971f41f--