Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100643 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48923 invoked from network); 15 Sep 2017 17:50:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Sep 2017 17:50:41 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.220.172 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.220.172 mail-qk0-f172.google.com Received: from [209.85.220.172] ([209.85.220.172:47242] helo=mail-qk0-f172.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1C/C4-19300-EE21CB95 for ; Fri, 15 Sep 2017 13:50:38 -0400 Received: by mail-qk0-f172.google.com with SMTP id b82so2755626qkc.4 for ; Fri, 15 Sep 2017 10:50:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=jV3FHnfGDLwTqw2RkI8OlrUNfXMRs4akOmfKDXqdxng=; b=yF/sZblIosOdxMA4M7AsVDaB2r+z8aIxHivXadmMpiYBzhn/og+PxrcryyBySzLozC hHY0jK6/s5eine4P26zf5NgFDPBVSWZb1yGquhuZFbYNOJFYot2qZWFUUa7V8C2E0J0Q 6KF78v9dSFvAnGZpKbva5YGHtHIPsDny/1hHXNLGcumsANyM4uEGBLJs52nc/m33vJtZ cxgGW50IexNbaXaxfhalCcUQYtQbyzYJLvhOCJPL5tHATDZp8Xbd6qzAonYYp8G0tJL/ LL+CGP6dbhs5MYcQNaofqvZZ5iL3SArwYdoGywhchlRT8zvoiBaJvtkVj5neoLaeePTB 5DrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=jV3FHnfGDLwTqw2RkI8OlrUNfXMRs4akOmfKDXqdxng=; b=L5jzpuZkM6HhzS4/D7YyTzqvUaj1E2UdqMgMVGATBb97klljaguCph91FTCTyseOPW sWIeHtHxWPSm0d7jku/h6+CrTqycJXVftGIEsEK6Yz6TAHwVTdCl4o/OxtUCYdB26341 vrGK6cC5etrEeDLxusiLSMB9GD9VWbydfNJ2rvLi0rDEeuN7HD9E2+jODanQaUhS5dKo mddOg4f9Hvboaf7Yz/5zMwurXZ2pV+ZP8tpq/ANGoaUHVJBweZh6WCTpunVlj4nSQXcp sQzU/Bab6lSDDb2tgtRV7n0FkTyeCr2lw56wfHeSw7KbErgv0A/NcYqRSj/xD9UX37tP 7g0Q== X-Gm-Message-State: AHPjjUiWjq6LnUNmp3m5abJC/DUqrq/aCP4rr3qjsE+PyyRiZFGqOKgU Ht8gIqvYvAjRrvDR2ZxeLehOFnTceY+2Vwd7I8c67A== X-Google-Smtp-Source: AOwi7QCrHdQ8ksmwKzG9x52vW4XQTKkIro1de7CJpNOCoq4eUojKvKrRn2t4UCvQslePJ1PEPLPCY5II9jO/DsRbxqg= X-Received: by 10.55.33.75 with SMTP id h72mr8229843qkh.132.1505497836030; Fri, 15 Sep 2017 10:50:36 -0700 (PDT) MIME-Version: 1.0 Sender: php@golemon.com Received: by 10.12.132.3 with HTTP; Fri, 15 Sep 2017 10:50:35 -0700 (PDT) X-Originating-IP: [206.252.215.26] In-Reply-To: <7d703ad8-5596-44e7-95dc-23c2cc058408@Spark> References: <097578bf-ab74-44cf-a465-dc6fdd50930f@Spark> <7d703ad8-5596-44e7-95dc-23c2cc058408@Spark> Date: Fri, 15 Sep 2017 13:50:35 -0400 X-Google-Sender-Auth: jwXsDhmQrr9-ce53cKGqzaWfEIs Message-ID: To: Ilija Tovilo Cc: Marco Pivetta , PHP internals Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] Deprecate the extract function in PHP 7.3 From: pollita@php.net (Sara Golemon) 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'. 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