Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89961 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6730 invoked from network); 2 Jan 2016 03:10:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Jan 2016 03:10:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=bishop.bettini@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bishop.bettini@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.47 as permitted sender) X-PHP-List-Original-Sender: bishop.bettini@gmail.com X-Host-Fingerprint: 74.125.82.47 mail-wm0-f47.google.com Received: from [74.125.82.47] ([74.125.82.47:34642] helo=mail-wm0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A0/45-06661-69F37865 for ; Fri, 01 Jan 2016 22:10:14 -0500 Received: by mail-wm0-f47.google.com with SMTP id u188so95803543wmu.1 for ; Fri, 01 Jan 2016 19:10:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=yVcrzUzKRsNhE1WypfmoydxAWMDKca7CoTQlyxH3GME=; b=wLooWL25oPpIxUsDhv6HxgkxWRfg1pPgSPMaQO8OjyIgzwYFlFX0uZUm/odZhxu+Jg FDSDEyPdPYQ0+8aV7K+rEqXT+0x1D20/m98+v/9HJpjgC5rHVbPz7EVfdG3+OB02Am/j g85xjPh/J0Q1z0Weyx6COeE5dp6Fafxiq/+zPYwnamygILFxcO7nd63k4eAzbtBhFaf4 NWN5U96koCTLs1Q+FozR92ek4Tvc3+pk7Lv6L8W/kmhIvpG6vvNQXWz/20AW/qvlOaJi gN51ITon3DOUhE0llUPcVdYfs6htyptXJE5bzsyVwHckSRlaKeKMCq/njzRQZ7sOz56t XtnA== X-Received: by 10.194.209.129 with SMTP id mm1mr44439142wjc.47.1451704211539; Fri, 01 Jan 2016 19:10:11 -0800 (PST) MIME-Version: 1.0 Reply-To: bishop@php.net Sender: bishop.bettini@gmail.com Received: by 10.194.45.230 with HTTP; Fri, 1 Jan 2016 19:09:42 -0800 (PST) In-Reply-To: References: Date: Fri, 1 Jan 2016 22:09:42 -0500 X-Google-Sender-Auth: 4QEG7eVuKxbwFOZHgZfA9vSGWHk Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary=047d7b3a840ad90b670528513970 Subject: Re: [PHP-DEV] [RFC] On-Demand Name Mangling From: bishop@php.net (Bishop Bettini) --047d7b3a840ad90b670528513970 Content-Type: text/plain; charset=UTF-8 On Fri, Jan 1, 2016 at 5:11 PM, Nikita Popov wrote: > On Fri, Jan 1, 2016 at 10:47 PM, Bishop Bettini wrote: > >> Hello Internals, >> >> Ringing in the new year with a proposal to retool name mangling: >> >> Mangling has the undesirable consequence that many external variables may >> map to one PHP variable. This leads to user confusion and user-land >> workarounds, not to mention bug reports. Since register_globals has been >> removed, we can replace automatic name mangling with on-demand mangling >> via >> extract(). This allows a one-to-one between external and PHP super-global >> variables, while fixing a few bug reports on extract as well. >> >> RFC: https://wiki.php.net/rfc/on_demand_name_mangling >> >> Thanks in advance for your feedback! >> bishop >> > > I like the idea of getting rid of name mangling, but don't like the > particular approach you propose here. In particular anything that will > result in an arbitrary number of deprecation notices *controlled by user > input* is a no go for me. > Agreed. The message intends to provide some warning to application developers when there is known use of name mangling. As such, a single warning when the mangler runs is sufficient to meet this intent. I think this is one of the rare cases where I would favor the introduction > of a new ini setting. E.g. mangle_names=0 disables name mangling, while > mangle_names=1 throws a deprecation warning on startup and enables name > mangling. mangle_names=0 should be the default. That is essentially disable > name mangling, but leave an escape hatch for those people who rely on it > (for whatever reason). > An INI setting to disable mangling must be engine-wide. In a hosted environment where many unrelated sites share the same engine configuration, it's possible that one site might require mangling while another site requires no-mangling. These two sites could not co-exist with an engine setting. But, even without a setting, there's an escape hatch: userland can polyfill the mangling behavior using extract. The updated RFC demonstrates an algorithm. > Furthermore I don't like the suggestion that extract() should start > mangling names by default. Currently "invalid" variable names will be > ignored by extract(). We can introduce a EXTR_MANGLE_INVALID option for > those who want it. Additionally we can also provide an EXTR_ALLOW_INVALID > option, which simply extracts "invalid" names normally. (Imho that should > be the default behavior. "Invalid" in this context is a misnomer, these > variable names are perfectly fine and easily accessible.) > Agreed, that would unnecessarily introduce a BC break on extract. A new option makes the most sense. I've updated the RFC in light of all your comments/suggestions. Thanks for them! --047d7b3a840ad90b670528513970--