On 02/01/2016 03:09, Bishop Bettini wrote:
But, even without a setting, there's an escape hatch: userland can polyfill
the mangling behavior using extract. The updated RFC demonstrates an
algorithm.
I'm not that comfortable with requiring / encouraging the use of
extract() - a rather awkward function which clobbers your local variable
space in unpredictable ways - to write the polyfill. The fact that the
clobbering is necessary / useful for extract() is wholly unrelated to
the need for BC in super-global arrays.
It would be more useful to expose a method or regex constant to userland
so that the mangling can actually be done in place on appropriate arrays:
$old_get = $_GET;
$_GET = [];
foreach ( $old_get as $old_key => $value ) {
$new_key = preg_replace(PHP_ILLEGAL_NAME_REGEX, '_', $old_key);
$_GET[$new_key] = $value;
}
Regards,
--
Rowan Collins
[IMSoP]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php