Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100637 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38549 invoked from network); 15 Sep 2017 17:21:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Sep 2017 17:21:56 -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.142.194.251 as permitted sender) X-PHP-List-Original-Sender: ilija.tovilo@me.com X-Host-Fingerprint: 17.142.194.251 pv33p00im-asmtp002.me.com Received: from [17.142.194.251] ([17.142.194.251:58172] helo=pv33p00im-asmtp002.me.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/82-19300-23C0CB95 for ; Fri, 15 Sep 2017 13:21:55 -0400 Received: from process-dkim-sign-daemon.pv33p00im-asmtp002.me.com by pv33p00im-asmtp002.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0OWB00D00ZB19P00@pv33p00im-asmtp002.me.com> for internals@lists.php.net; Fri, 15 Sep 2017 17:21:38 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1505496098; bh=xZQ2L7fiPTNCH41ih6wqDrI7rZmlWLvzDIF10QVbFRY=; h=Date:From:To:Message-id:Subject:MIME-version:Content-type; b=u6rPm8PwfMIFJ4rpFODfRXYXGp9JTqPx8xaUCELfwxeRkP8bg/M+NSU/Rr+BzihrW 6gTkUUMHZ9G5TUpYJwd6jV1aPQFNH+/WmWmDOaB+SOmJUphtmAxxGkC5cOw6bzN8AN 8pn+uZmetl9QKhxgVwS15odCrdhBWXf8Uu8ToiRPK96uqxp3c67sYYkjFytI4ZSApA QuTKqX6Y64lQ7/bw9QGnii/RrK9mY6wSxWt1GV678LM6PA9ZEXjeS4z339kv4VJk+Z 0H16h5KgR6c9DtXRrstX6X5+eFCq8JEpUqhluL6hZrsgw2YbO77DArokmHe0ZWyQ0f tasNEOdHO1vMQ== Received: from icloud.com ([127.0.0.1]) by pv33p00im-asmtp002.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0OWC008IE07VQP20@pv33p00im-asmtp002.me.com> for internals@lists.php.net; Fri, 15 Sep 2017 17:21:34 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-15_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1015 suspectscore=34 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709150252 Date: Fri, 15 Sep 2017 19:20:59 +0200 To: PHP internals Message-ID: <097578bf-ab74-44cf-a465-dc6fdd50930f@Spark> X-Readdle-Message-ID: 097578bf-ab74-44cf-a465-dc6fdd50930f@Spark MIME-version: 1.0 Content-type: multipart/alternative; boundary=59bc0c18_6b8b4567_73e9 Subject: [RFC] Deprecate the extract function in PHP 7.3 From: ilija.tovilo@me.com --59bc0c18_6b8b4567_73e9 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi=21 The =60extract=60 function takes an associative array and puts it into th= e local symbol table. http://php.net/manual/en/function.extract.php =60=60=60 =24array =3D =5B =C2=A0 =C2=A0 =E2=80=98foo=E2=80=99 =3D> =E2=80=98foo=E2=80=99, =C2=A0 =C2=A0 =E2=80=98bar=E2=80=99 =3D> =E2=80=98bar=E2=80=99, =5D; extract(=24array); print =24foo; // =22foo=22 =60=60=60 As a second parameter the =60extract=60 function takes some options to ma= ke this function less dangerous, like =60EXTR=5FSKIP=60 that prevents an = existing local variable of being overwritten. There=E2=80=99s a few more = options, go ahead and take a look at the documentation. =60EXTR=5FOVERWRI= TE=60 is the default one though. You can also pass a prefix for the varia= ble names as a third argument. 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 deprecat= ing it in PHP 7.3 and removing it in 8. In a whole Symfony-Stack (3.4) with all of it=E2=80=99s dependencies I co= uld only find two usages of this function, both of which could be easily = rewritten in vanilla PHP: https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Temp= lating/PhpEngine.php=23L148 https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Temp= lating/PhpEngine.php=23L158 Only downside: A polyfill is probably impossible since you cannot mutate = the local symbol table of the callee (as far as I=E2=80=99m aware). Any thoughts=3F Regards --59bc0c18_6b8b4567_73e9--