#19131 [Com]: var_dump seems to be fooled by ?a vs ?a=

From: Date: Tue, 27 Aug 2002 23:25:08 +0000
Subject: #19131 [Com]: var_dump seems to be fooled by ?a vs ?a=
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-17974@lists.php.net to get a copy of this message
ID: 19131 Comment by: pzb@ximian.com Reported By: bryce@redhat.com Status: Open Bug Type: Variables related Operating System: Linux (RH 7.2) PHP Version: 4.1.2 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#17974) next »