|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-06-14 23:01 UTC] tavin dot cole at gmail dot com
Description: ------------ It's well known that PHP converts dots to underscores for incoming variable names. This is very frustrating when writing modern PHP code with register_globals off and using $_REQUEST etc. instead. It's been stated this will not be changed due to BC issues. Why not introduce an INI setting to inhibit this behavior? Thanks for your consideration. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 05:00:01 2025 UTC |
the following is a trivial patch for those needing a workaround to this problem. it only inhibits the munging of dots and doesn't address things like spaces and square brackets. it also doesn't address introducing an INI setting. diff -ru php-5.2.6._dist/main/php_variables.c php-5.2.6._mine/main/php_variables.c --- php-5.2.6._dist/main/php_variables.c 2007-12-31 07:20:15.000000000 +0000 +++ php-5.2.6._mine/main/php_variables.c 2008-06-14 23:34:25.000000000 +0000 @@ -91,7 +91,7 @@ /* ensure that we don't have spaces or dots in the variable name (not binary safe) */ for (p = var; *p; p++) { - if (*p == ' ' || *p == '.') { + if (*p == ' ' /*|| *p == '.'*/) { *p='_'; } else if (*p == '[') { is_array = 1;As I understand, requirement of convert dots and spaces to underscores inside $_GET variable and in result of parse_str() was "Using Register Globals" ("because variables in PHP can't have dots and spaces in their names"). Now "Using Register Globals" was removed in php 5.4.0! But convert dots and spaces still here... Can you add option in ini-file and argument for parse_str() to do not convert dots and spaces?