Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100648 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58015 invoked from network); 15 Sep 2017 19:00:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Sep 2017 19:00:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=ilija.tovilo@me.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ilija.tovilo@me.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain me.com designates 17.172.220.113 as permitted sender) X-PHP-List-Original-Sender: ilija.tovilo@me.com X-Host-Fingerprint: 17.172.220.113 st11p02im-asmtp001.me.com Received: from [17.172.220.113] ([17.172.220.113:61265] helo=st11p02im-asmtp001.me.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9F/66-19300-0532CB95 for ; Fri, 15 Sep 2017 15:00:33 -0400 Received: from process-dkim-sign-daemon.st11p02im-asmtp001.me.com by st11p02im-asmtp001.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0OWC01D004MTA800@st11p02im-asmtp001.me.com> for internals@lists.php.net; Fri, 15 Sep 2017 19:00:29 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1505502029; bh=JcRrlpAEQJsLJkHScqbb7I8wAUMoUqlOqaHD0pTqWgQ=; h=Content-type:MIME-version:Subject:From:Date:Message-id:To; b=4vDqeUlp+fNcsSgg9p8HHQesffWj/tgVmReqAla6tYAqVmar5r4tioNA9xfRw01o/ MDX7CyBJnLRzMtdlN7AS5dHgxAef3KRdGTkVCmU9pLYypDW6I5/S+OWHyHp3asAi8z 37iPKCWv2wEtcB0vrvi+GEIKkS8bcTHaQjYMl5rUGG9WmtlSlC2tQ1zcutLQo9MxhE t7CdV0vPf6L6Y3eXRkr8BvmGaw4sySg0KbmCIy6gq5Y0Gb+lf4VAg3GZHsxJPM+Yb6 +rBYOujFCPWdZ699K5djv5TuPDlvi2TkiXeL+m+cqUeRo1JpDIAYY/4PDKR+JIrieT Jnj6tyPcCrRHw== Received: from icloud.com ([127.0.0.1]) by st11p02im-asmtp001.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0OWC01BDK4SPNL40@st11p02im-asmtp001.me.com>; Fri, 15 Sep 2017 19:00:27 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-15_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709150278 Content-type: text/plain; charset=utf-8 MIME-version: 1.0 (1.0) X-Mailer: iPhone Mail (14G60) In-reply-to: Date: Fri, 15 Sep 2017 21:00:24 +0200 Cc: Marco Pivetta , PHP internals Content-transfer-encoding: quoted-printable Message-ID: <81BBA973-F0B8-4C0F-BFAC-F4FAAD122D5E@me.com> References: <097578bf-ab74-44cf-a465-dc6fdd50930f@Spark> <7d703ad8-5596-44e7-95dc-23c2cc058408@Spark> To: Sara Golemon Subject: Re: [PHP-DEV] [RFC] Deprecate the extract function in PHP 7.3 From: ilija.tovilo@me.com (Ilija Tovilo) Hi Sara That is indeed a very good point. Haven't thought of that one. Regards > On 15. Sep 2017, at 19:50, Sara Golemon wrote: >=20 >> On Fri, Sep 15, 2017 at 1:35 PM, wrote: >> The `extract` function takes an associative array and >> puts it into the local symbol table. >> http://php.net/manual/en/function.extract.php >>=20 >> I seriously doubt the usefulness of this function, >> especially looking at the potential risks. The fact >> that overwriting the local variables is the default >> behaviour doesn=E2=80=99t make it any better. I suggest >> deprecating it in PHP 7.3 and removing it in 8. >>=20 > Preface: I despise extract() as well. It's breaks assumptions for > both the developer and the runtime. I save some of my frowniest of > faces for extract(). >=20 > That said... >=20 >> I can see it=E2=80=99s usefulness in this case. >> But wouldn=E2=80=99t it be better to implement this by hand >> in these rare cases (it=E2=80=99s 3 lines of code) instead of >> encouraging the pollution of the symbol table by >> unknown input? It=E2=80=99s also clearer since people who >> don=E2=80=99t know the `extract` function probably don=E2=80=99t >> expect it to mutate the local symbol table. >>=20 > Let's be clear on what that looks like: foreach ($data as $key =3D> > $value) { $$key =3D $value; } >=20 > This is SO MUCH WORSE for several reasons, no least of all what > happens when $data contains keys named 'data', 'key', or 'value'. >=20 > I'd like to kill extract(), but it does have a reason for being, and I > couldn't in any good conscience support removing it without a > replacement that's at least marginally better. >=20 > -Sara >=20 > --=20 > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >=20