From:             sibaz at sibaz dot com
Operating system: All
PHP version:      4.3.2
PHP Bug Type:     Feature/Change Request
Bug description:  optionally parse_str shouldn't mangle fieldnames when theyre only 
array indexes

Description:
------------
Understandably parse_str mangles CGI field names to fit into the PHP
variable name space.  
When given a second array parameter the mangled variable names are used as
indexes in the array, as documented. However the more intuitive
implementation would be for the array index to be the actual unmangled CGI
field name specified.  It makes more sense to me, to not mangle variable
names, when populating an array.  
Clearly a change of existing behaviour would be damaging, so perhaps a
config or ini setting could be used to turn off name mangling for array
indexes, or perhaps a third optional parameter to the function could
dictate whether or not to mangle the names.  
The primary need for this is to avoid mangling when using fieldnames that
are sqlfield names.  These may contain dots if the field name is fully
qualified to include the table name it is dotted.  It seems a waste to
have to invent a separate mangling process for phpfield name (hiding
sqlfield name) just because of unneeded, unpreventable mangling within
php.  IMHO $_GET should be an array of unmangled CGI Field names.  

Reproduce code:
---------------
$array=array();
parse_str("this.that=1", $array);
echo serialize($array)."<br>\n";
// prints a:1:{s:9:"this_that";s:1:"1";}


Expected result:
----------------
// ideally it should print a:1:{s:9:"this.that";s:1:"1";}

Actual result:
--------------
// it currently prints a:1:{s:9:"this_that";s:1:"1";}


-- 
Edit bug report at http://bugs.php.net/?id=25139&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25139&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25139&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25139&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25139&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25139&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25139&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25139&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25139&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25139&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25139&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25139&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25139&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25139&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25139&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25139&r=gnused

Reply via email to