Req #45272 [Opn->Sus]: no ini setting to inhibit conversion of dots to underscores in $_REQUEST

From: Date: Mon, 12 Aug 2019 14:37:47 +0000
Subject: Req #45272 [Opn->Sus]: no ini setting to inhibit conversion of dots to underscores in $_REQUEST
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222198@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=45272&edit=1 ID: 45272 Updated by: requinix@php.net Reported by: tavin dot cole at gmail dot com Summary: no ini setting to inhibit conversion of dots to underscores in $_REQUEST -Status: Open +Status: Suspended Type: Feature/Change Request Package: *Web Server problem Operating System: any PHP Version: 5.2.6 Block user comment: N Private report: N New Comment: INI options sound easy but they can make writing portable code difficult and so are avoided whenever possible. This subject has come up recently on the internals mailing list as something to reconsider for PHP 8. https://php.markmail.org/thread/e2wpxygeblezyzf2 Previous Comments: ------------------------------------------------------------------------ [2019-08-12 14:21:40] sailormax at inbox dot lv 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? ------------------------------------------------------------------------ [2018-07-18 12:03:03] strijbol dot niko at gmail dot com Has there been any progress on this? ------------------------------------------------------------------------ [2012-05-14 03:18:20] pravdin at vl dot ru In PHP 5.4 INI the register_globals setting was removed finally. So, this atricle in documentation become not true: "Dots in incoming variable names Typically, PHP does not alter the names of variables when they are passed into a script. However, it should be noted that the dot (period, full stop) is not a valid character in a PHP variable name." Because external variables will never become internal variables, translation dots to underscores become senseless. Please, add an INI setting to disable dots to underscores translation! ------------------------------------------------------------------------ [2008-06-15 17:52:45] tavin dot cole at gmail dot com 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; ------------------------------------------------------------------------ [2008-06-14 23:01:55] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=45272&edit=1

« previous php.bugs (#222198) next »