#8449 [Com]: register_globals=on and track_vars=on produce strange results for arrays
| From: | oregon at pobox dot com | Date: | Fri, 02 May 2003 19:19:13 +0000 |
| Subject: | #8449 [Com]: register_globals=on and track_vars=on produce strange results for arrays | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-38952@lists.php.net to get a copy of this message | ||
ID: 8449
Comment by: oregon at pobox dot com
Reported By: omakarenko at cyberplat dot ru
Status: Bogus
Bug Type: Arrays related
Operating System: linux
PHP Version: 4.1.0RC1
New Comment:
Why is this bug marked as Bogus? It's absolutely a bug and it needs to
be fixed because it's breaking correctly written scripts that worked in
earlier PHP versions. I'll re-submit it...
Previous Comments:
------------------------------------------------------------------------
[2002-02-27 00:32:06] yohgaki@php.net
We should get rid register_globals feature from PHP5 :)
(There is import_request_variable() for compatibility also)
------------------------------------------------------------------------
[2002-02-26 22:58:09] rodif_bl@php.net
I looked into this...
When you have register globals on it registers the
$person as a global array when parsing the get request it adds [age] to
the global $person array then when the post requet is parsed then it
finds the global array and adds the [sname] to the same array. So this
is what should happen.
why are you using get and post requests...
why don't you just use
<input type=hidden name=person[blah] value=blah>
------------------------------------------------------------------------
[2001-10-21 01:27:24] sniper@php.net
Reproduced also with PHP 4.1.0RC1
Here is the complete script for all the lazy developers
to try with:
form.php:
---------
<form action="form.php?person[age]=12" method=post>
<input type=text size=32 name=person[sname]
</form>
<br>
<?php
echo "HTTP_POST_VARS<br>";
print_r($HTTP_POST_VARS);
echo "<p>";
echo "HTTP_GET_VARS<br>";
print_r($HTTP_GET_VARS);
echo "<p>";
echo "_POST<br>";
print_r($_POST);
echo "<p>";
echo "_GET<br>";
print_r($_GET)
?>
------------------------------------------------------------------------
[2001-08-19 03:01:43] sniper@php.net
Oops. I had register_globals=off in my php.ini.
Then this works as expected. But when it is On, not.
--Jani
------------------------------------------------------------------------
[2001-08-19 02:57:36] sniper@php.net
This is fixed at least in PHP 4.0.6.
Maybe even earlier.
--Jani
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/8449
--
Edit this bug report at http://bugs.php.net/?id=8449&edit=1