On Fri, Jan 1, 2016 at 10:47 PM, Bishop Bettini <bis...@php.net> 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.

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).

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.)

Nikita

Reply via email to