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

From: Date: Tue, 27 Aug 2002 20:29:45 +0000
Subject: #19131 [NEW]: var_dump seems to be fooled by ?a vs ?a=
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-17962@lists.php.net to get a copy of this message
From: bryce@redhat.com Operating system: Linux (RH 7.2) PHP version: 4.1.2 PHP Bug Type: Variables related Bug description: var_dump seems to be fooled by ?a vs ?a= 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 bug report at http://bugs.php.net/?id=19131&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=19131&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=19131&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=19131&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=19131&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=19131&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=19131&r=support Expected behavior: http://bugs.php.net/fix.php?id=19131&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=19131&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=19131&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=19131&r=globals

« previous php.bugs (#17962) next »