rfc:on_demand_name_mangling

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
rfc:on_demand_name_mangling [2016/01/09 02:13] – Removed deprecation message in favor of documentation changes bishoprfc:on_demand_name_mangling [2019/07/16 12:24] – Updated to contemporary PHP versions and readied for vote. bishop
Line 1: Line 1:
 ====== PHP RFC: On-demand Name Mangling ====== ====== PHP RFC: On-demand Name Mangling ======
-  * Version: 1.3+  * Version: 1.4
   * Created Date: 2016-01-01   * Created Date: 2016-01-01
-  * Updated Date: 2016-01-08 +  * Updated Date: 2019-07-16 
-  * Author: Bishop Bettinibishop@php.net+  * Author: Bishop Bettini <bishop@php.net>
   * Status: Under Discussion   * Status: Under Discussion
   * First Published at: http://wiki.php.net/rfc/on_demand_name_mangling   * First Published at: http://wiki.php.net/rfc/on_demand_name_mangling
Line 81: Line 81:
     [_GET] => Array     [_GET] => Array
         (         (
-            [a.b] => dot 
             [a_b] => bracket             [a_b] => bracket
             [a$b] => dollar             [a$b] => dollar
-            [a b] => space 
-            [a[b] => bracket 
         )         )
 ) )
Line 106: Line 103:
 This RFC proposes to remove automatic name mangling, with backward compatibility maintained through a userspace polyfill function that mangles super-globals on-demand:  This RFC proposes to remove automatic name mangling, with backward compatibility maintained through a userspace polyfill function that mangles super-globals on-demand: 
  
-  * Next minor release (currently 7.1):+  * Upon acceptance:
     * Update documentation that name mangling is deprecated and will be removed in 8.0     * Update documentation that name mangling is deprecated and will be removed in 8.0
-  * Between RFC acceptance and the next major release: +    * Release a userland polyfill that implements the historic mangling behavior
-    * Release a userland polyfill that implements ''mangle_superglobals''+
     * Polyfill shall be available via composer (but not PEAR)     * Polyfill shall be available via composer (but not PEAR)
   * Next major release (currently 8.0):   * Next major release (currently 8.0):
-    * Remove all name mangling code in super-global marshalling functions+    * Remove all name mangling code in super-global marshaling functions
  
 ==== Discussion ==== ==== Discussion ====
Line 159: Line 155:
  
 <code php> <code php>
-function mangle_name($name) {+function php_mangle_name($name) {
     $name = preg_replace('/[^a-zA-Z0-9_\x7f-\xff]/', '_', $name);     $name = preg_replace('/[^a-zA-Z0-9_\x7f-\xff]/', '_', $name);
     return preg_replace('/^[0-9]/', '_', $name);     return preg_replace('/^[0-9]/', '_', $name);
 } }
-function mangle_superglobals() {+function php_mangle_superglobals() {
     if (version_compare(PHP_VERSION, '8.0.0', '<')) {     if (version_compare(PHP_VERSION, '8.0.0', '<')) {
         return;         return;
     }     }
     foreach ($_ENV as $var => &$val) {     foreach ($_ENV as $var => &$val) {
-        $mangled = mangle_name($var);+        $mangled = php_mangle_name($var);
         if ($mangled !== $var) {         if ($mangled !== $var) {
             $_ENV[$mangled] =& $val;             $_ENV[$mangled] =& $val;
Line 186: Line 182:
 require __DIR__ . '/vendor/autoload.php'; require __DIR__ . '/vendor/autoload.php';
  
-mangle_superglobals();+php_mangle_superglobals();
  
 // ... // ...
Line 192: Line 188:
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
-PHP 7.1 (for notice of impending BC break) and PHP 8.0 (for actual implementation and corresponding BC break).+PHP 8.0.
  
 ===== RFC Impact ===== ===== RFC Impact =====
Line 211: Line 207:
  
 ===== Open Issues ===== ===== Open Issues =====
-None so far.+None.
  
 ===== Proposed Voting Choices ===== ===== Proposed Voting Choices =====
-A simple yes/no voting option with a 2/3 majority required.+A simple yes/no voting option with a 2/3 majority required: "Remove name mangling in PHP 8.0?"
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
rfc/on_demand_name_mangling.txt · Last modified: 2019/07/16 12:25 by bishop