Re: [RFC] On-Demand Name Mangling
| From: | Rowan Collins | Date: | Sat, 02 Jan 2016 16:45:52 +0000 |
| Subject: | Re: [RFC] On-Demand Name Mangling | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-89966@lists.php.net to get a copy of this message | ||
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]