#25139 [Opn->WFx]: parse_str should optionally not mangle array index names

From: Date: Tue, 19 Aug 2003 08:13:30 +0000
Subject: #25139 [Opn->WFx]: parse_str should optionally not mangle array index names
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-46180@lists.php.net to get a copy of this message
ID: 25139 Updated by: derick@php.net Reported By: sibaz at sibaz dot com -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: All PHP Version: 4.3.2 New Comment: We can not change it as you suggested, and we are not going to add an ini-setting for this because that will make writing portable scripts much harder. Previous Comments: ------------------------------------------------------------------------ [2003-08-18 22:39:51] sibaz at sibaz dot com Summary was unclearly worded ------------------------------------------------------------------------ [2003-08-18 22:35:38] sibaz at sibaz dot com 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 this bug report at http://bugs.php.net/?id=25139&edit=1

« previous php.bugs (#46180) next »