Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115702 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96687 invoked from network); 13 Aug 2021 12:57:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Aug 2021 12:57:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id D2AEB1804BD for ; Fri, 13 Aug 2021 06:29:13 -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=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (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 06:29:13 -0700 (PDT) Received: by mail-lf1-f49.google.com with SMTP id z20so19945018lfd.2 for ; Fri, 13 Aug 2021 06:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=Kfu30yT/7xu90ZaFpKbocgl68C8Z9XKN/nxVp8Tn310=; b=TfiXcrTxKaLDamJL7nRHulhlP5SEyUXxfEZUlYTSd74v93VeP4+VylKoxep25CQums 6uLQoASryuPdsgL3EFOS89gZ/ixahHAjoHOQMzphfSWucOO7K1NZUktdU3250LhaQuvS od5KXiABmiCK2MJTQ4IOmySyNY7s3/tXSeYdYYWEX60agDO4yT4T9ggceHPWLwr/iEcG MKaC9706N78hhhMk96+tM/RfpnAafR2pQ1VvchVvR5YH5Guq+rxkvXMCDr2cyZFm0CRt H/mZt7Z15xIVnfBA3zObkBR3GyrA1u5vh3AB+3vLOITqgvyOX/9eCNYiLmFvI9kLd3UF AJkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=Kfu30yT/7xu90ZaFpKbocgl68C8Z9XKN/nxVp8Tn310=; b=j/5PtBJ2nrij84sUsTWoHc0AS8kNFmoAbsJqPcpFkAkOHlMkkZrFHjDtd7fTMtL/Yy 6G0YfqGk21HRAxLCOT4Fez3+LY8B21zLFC18jWQa6vrpDmrchfGdAGbJFsinhe8MFdHt /AdkFO7LcoOgv6/zHM1/MxLEi1EFVtNKpqCupC4P9luIESXTUz0i4YgVp7X0NHuwuyWB P+gAYtdZun08wqSgWdZFn5+Ir1n4p1Tkoaem+gpfwvR17mwa03u3XTINnufV+Yv+XSoH ch7bBVZ+VuhhvGdhCvUyrO540veKG6S5f4PQUNRlSISRTp50bJVolnkL8DEzOywOJqe9 KGwg== X-Gm-Message-State: AOAM533QXUfp0KuY2F4gh+sP7NML3kNQxKm+JosTzVCRegJJdJh7AJVz 7EQ+DqaaMwa14RvT3ztgWsoBSMukjW6oly/gOvoR5Olrv/UNzg== X-Google-Smtp-Source: ABdhPJwgS+hyd310htpwISlWAMQuYIkV/RKQkZKopt5Z6JkLSIzEOxLlgLno95W0GhdZZ954JFw/K7xQtqiyF6NtIpA= X-Received: by 2002:a19:ae0a:: with SMTP id f10mr1624081lfc.223.1628861350486; Fri, 13 Aug 2021 06:29:10 -0700 (PDT) MIME-Version: 1.0 Date: Fri, 13 Aug 2021 15:28:54 +0200 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="0000000000002f246805c970d6d4" Subject: Unwrap reference after foreach From: nikita.ppv@gmail.com (Nikita Popov) --0000000000002f246805c970d6d4 Content-Type: text/plain; charset="UTF-8" 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 --0000000000002f246805c970d6d4--