ID:               40000
 Updated by:       [EMAIL PROTECTED]
 Reported By:      bertrand at epistema dot com
-Status:           Open
+Status:           Wont fix
 Bug Type:         Feature/Change Request
 Operating System: linux debian
 PHP Version:      4.4.4
 New Comment:

Yes, but changing this breaks BC unnecessarily, so we won't change it.


Previous Comments:
------------------------------------------------------------------------

[2007-01-02 15:23:19] bertrand at epistema dot com

Derick, thanks for reviewing this bug.

After quite a lot of searching, I found the reason why: it all comes
from the old "register globals" days. Obviously, a variable named
$test.one would not be valid.

Now, those variables are valid in a form (and in a URL), as stated
here:

http://www.w3.org/TR/1999/REC-html401-19991224/types.html#type-cdata

Quote : ID and NAME tokens must begin with a letter ([A-Za-z]) and may
be followed by any number of letters, digits ([0-9]), hyphens ("-"),
underscores ("_"), colons (":"), and periods (".").

Therefore, one could think that since it fits in the $_POST array
without problem, the underscoring of dots and spaces could only be done
when registring the globals by their names, but not in the $_POST and
$_GET variables.

In other words, if taking the example, that could give:

$test_one => 1
$test.two => 2

but also:
 
$_POST['test.one'] => 1
$_POST['test.two'] => 2

I still consider this to be a bug, since this behaviour is *not
documented* nor logical (in the case you use $_POST and $_GET variables
and not register_globals, as everybody does).

------------------------------------------------------------------------

[2007-01-02 13:55:38] [EMAIL PROTECTED]

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

This has been filed many times... and it\'s not a bug.

------------------------------------------------------------------------

[2007-01-02 13:51:06] bertrand at epistema dot com

Description:
------------
Can someone please add more information to bug 34578 ?

The only two places in the documentation that refers to the fact that
PHP replaces dots with underscores in variable names are
http://fr.php.net/manual/en/language.variables.predefined.php#64336 and
http://fr.php.net/manual/en/language.variables.external.php but doesn't
really help on the why of this behaviour...

Are dots not valid in variable names ? Since when ?

Reproduce code:
---------------
<?php

echo '<pre>what : <br>' . print_r($_GET, true) . '</pre><br>';

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<form method="GET">
<input type="hidden" name="test.one" value="1" />
<input type="hidden" name="test.two" value="2" />
<input type="submit" name="submitMe" value="Click me" />
</form>

</body>
</html>


Expected result:
----------------
Array
(
    [test.one] => 1
    [test.two] => 2
    [submitMe] => Click me
)

Actual result:
--------------
Array
(
    [test_one] => 1
    [test_two] => 2
    [submitMe] => Click me
)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40000&edit=1

Reply via email to