Re: Key values starting with .
| From: | Andi Gutmans | Date: | Thu, 27 Jun 2002 16:35:22 +0000 |
| Subject: | Re: Key values starting with . | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-85634@lists.php.net to get a copy of this message | ||
At 08:32 AM 6/27/2002 -0700, Brian France wrote:
Hello,
I have a url that ends with ?.value=1, but PHP returns this in $_REQUEST as _value instead of .value. I believe this is because of this code:
main/php_variables.c
104 /* ensure that we don't have spaces or dots in the variable name (not binary safe) */
105 for (p=var; *p; p++) {
106 switch(*p) {
107 case ' ':
108 case '.':
109 *p='_';
110 break;
111 }
112 }
I can do this: $_REQUEST['.name'] = "testing" then if I do print_r($_REQUEST) prints it out as .value and not _value. Any reason for being able to do one, but not the other? Also what is the "(not binary safe)" part of a variable with a . in its name?
I guess this is a left over from register globals as you can't access variables with . such as $image.x won't work (yeah you could always use indirect references but I'm just saying what was probably the reasoning behind this).
Don't expect it to change because it'll kill a huge amount of PHP scripts.
Andi