#19131 [Opn->Csd]: var_dump seems to be fooled by ?a vs ?a=
| From: | sniper@php.net | Date: | Wed, 28 Aug 2002 02:15:17 +0000 |
| Subject: | #19131 [Opn->Csd]: var_dump seems to be fooled by ?a vs ?a= | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-17981@lists.php.net to get a copy of this message | ||
ID: 19131
Updated by: sniper@php.net
Reported By: bryce@redhat.com
-Status: Open
+Status: Closed
Bug Type: Variables related
Operating System: Linux (RH 7.2)
PHP Version: 4.1.2
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php4-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2002-08-27 19:25:07] pzb@ximian.com
This appears to be fixed in CVS. The culprit was a missing else in
main/php_variables.c in the
SAPI_TREAT_DATA_FUNC(php_default_treat_data) function.
------------------------------------------------------------------------
[2002-08-27 16:33:11] bryce@redhat.com
Actually I'd like to class it as a bug, even though the first variable
(&c) is malformed in test 3 I'd have expected the script to recover the
a=1 portion
This behaviour carries on into php 4.2.2
Phil
=--=
------------------------------------------------------------------------
[2002-08-27 16:29:44] bryce@redhat.com
Test php script.
[root@alpha root]# cat /var/www/html/test.php
<?php
reset($_GET);
var_dump($_GET);
?>
Test URLS.
1 - http://localhost/test.php?a=1&b=2&c
2 - http://localhost/test.php?a=1&b=2&c=
3 - http://localhost/test.php?c&b=2&a=1
4 - http://localhost/test.php?c=&b=2&a=1
Results.
1 array(2) { ["a"]=> string(1) "1" ["b"]=> string(1)
"2" }
2 array(3) { ["a"]=> string(1) "1" ["b"]=> string(1)
"2" ["c"]=>
string(0) "" }
3 array(2) { ["c"]=> string(0) "" ["b"]=> string(1)
"2" }
4 array(3) { ["c"]=> string(0) "" ["b"]=> string(1)
"2" ["a"]=>
string(1) "1" }
Variable count seems to be calculated by the number of ='s (Note how
a=1 drops off the argument list when the first param has no '='
associated with it.)
?a is legal html
however as far as I can tell all forms must pass in ?a= to make a valid
variable
I'm unsure what to class this as (bug or feature)
It was reported to Red Hat as
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=72752
Commets?
Phil
=--=
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19131&edit=1