Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100645 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51657 invoked from network); 15 Sep 2017 17:54:24 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Sep 2017 17:54:24 -0000 Authentication-Results: pb1.pair.com smtp.mail=derokorian@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=derokorian@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.177 as permitted sender) X-PHP-List-Original-Sender: derokorian@gmail.com X-Host-Fingerprint: 209.85.223.177 mail-io0-f177.google.com Received: from [209.85.223.177] ([209.85.223.177:43089] helo=mail-io0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 6D/65-19300-FC31CB95 for ; Fri, 15 Sep 2017 13:54:23 -0400 Received: by mail-io0-f177.google.com with SMTP id k101so10350074iod.0 for ; Fri, 15 Sep 2017 10:54:23 -0700 (PDT) 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=5XD5sBV+IpHU5VTUOICQpmRtZBd/sipZJNS7C1Fvi+8=; b=Z8JOVFnlN6yG97U+14YMSviSVmxGS72GqaHwmlUzsHMCB4PZ71YYjc447/kbsnVW1Y pXyEukuddd6Ow9+lQ0VK28BOvJUhuVyEfCewJ3y0dUBFonhorAXKDpNkFfrkVb5YJ+qs E5HKJMNAKmErkmtm2A8lLFYk35289fGdSraNLakVN7sQBOAiBoVQuUq+nigR+2dacsq8 +nt3KHQxcfGEjoB0e8LQLQUOBhR76zH/CxL/CqMRUcE8z8NBDmJZ81VFG3daMcBcJv8j GCpGDaFnHMpeGSf+ebUik0jXB/kuRp7s1pxBhOjXVFwvevXdkhNXc5xSFbkaaMXRhxGo uh0w== 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=5XD5sBV+IpHU5VTUOICQpmRtZBd/sipZJNS7C1Fvi+8=; b=Ll0JT0cOngt57+52aoac1i2LlA0V0uQ03vHGZfimuMNJn0xAzaSmbRNnWMVjXQp3yL JyV0wPclGs0dJsW5Xfugzv5S3v+V42WH2ex7vuTDkkLKDEBudEYEgbznaiFQauTPEYZj Ytx00uF8TVcsjau0U+Edw7WmuN9NyUUFItypQtICCWNrTI2/UBxNRgwtX5Koa+JYk0vd OumpEFnm0t1O9rnZCdbu5oGpgHIu4/85UpgHonLOM3cpmLcrU54x6lWPTG5g0Sz+/4dt N9sYwGGkVcAsSurHD9ElAns0PqKzzIZ/16FjlkP9i8w9n/+B3YG6vBCxBqIGTCwJASvE fJEQ== X-Gm-Message-State: AHPjjUjP2sRaLA7kFnPlcAh75K33sw17wuPRmakfPBjLgbANuFSDt0J6 /+SRYxiVj5p+r72sWnF6sppQtx5pMEkng6HmWQ== X-Google-Smtp-Source: AOwi7QB/cT0LFcJczVf6vFvtWbXITeZHJUYhKMwvBgWiZWTHOb5TirNI92CwCWZmJ7yICdIJXukDx56sP/u6qABSpsY= X-Received: by 10.202.196.14 with SMTP id u14mr16281825oif.299.1505498060348; Fri, 15 Sep 2017 10:54:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.61.117 with HTTP; Fri, 15 Sep 2017 10:54:19 -0700 (PDT) In-Reply-To: References: <097578bf-ab74-44cf-a465-dc6fdd50930f@Spark> <7d703ad8-5596-44e7-95dc-23c2cc058408@Spark> Date: Fri, 15 Sep 2017 11:54:19 -0600 Message-ID: To: Sara Golemon Cc: Ilija Tovilo , Marco Pivetta , PHP internals Content-Type: multipart/alternative; boundary="001a11352d3218e44405593e15d7" Subject: Re: [PHP-DEV] [RFC] Deprecate the extract function in PHP 7.3 From: derokorian@gmail.com (Ryan Pallas) --001a11352d3218e44405593e15d7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Sep 15, 2017 at 11:50 AM, Sara Golemon wrote: > 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 > > > > 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. > > > 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(). > > That said... > > > 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. > > > Let's be clear on what that looks like: foreach ($data as $key =3D> > $value) { $$key =3D $value; } > > This is SO MUCH WORSE for several reasons, no least of all what > happens when $data contains keys named 'data', 'key', or 'value'. > This is a very good point. I hadn't thought about keys being named that way, but obviously they could! *grumble* > > 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. > > -Sara > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --001a11352d3218e44405593e15d7--