#37522 [NEW]: Parse_str do not send back anything

From: Date: Fri, 19 May 2006 16:30:51 +0000
Subject: #37522 [NEW]: Parse_str do not send back anything
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-97371@lists.php.net to get a copy of this message
From: dams@php.net Operating system: osx PHP version: 5.1.4 PHP Bug Type: Strings related Bug description: Parse_str do not send back anything Description: ------------ Parse_str accepts the string, but do not send back anything. With one argument, no variable is created. If this is register_globals related, we should state it in the docs. With 2 arguments, the array is emptied, but not filled. This bugs is on PHP 5.1.4, 5.1.3 but not 4.4.2. Reproduce code: --------------- <?php $str = "first=value&arr[]=foo+bar&arr[]=baz"; parse_str($str); echo $first; // value echo $arr[0]; // foo bar echo $arr[1]; // baz parse_str($str, $output); echo $output['first']; // value echo $output['arr'][0]; // foo bar echo $output['arr'][1]; // baz var_dump($output); $query = 'parametre=valeur'; $q = array("1"); parse_str($query, $q); var_dump($parametre); var_dump($parametre2); var_dump($tableau); var_dump($q); ?> Expected result: ---------------- valuefoo barbazvaluefoo barbazarray(2) { ["first"]=> string(5) "value" ["arr"]=> array(2) { [0]=> string(7) "foo bar" [1]=> string(3) "baz" } } NULL NULL NULL array(1) { ["parametre"]=> string(6) "valeur" } Actual result: -------------- PHP Notice: Undefined variable: first in /Users/imac/ Desktop/test.bug.php on line 15 PHP Notice: Undefined variable: arr in /Users/imac/Desktop/ test.bug.php on line 16 PHP Notice: Undefined variable: arr in /Users/imac/Desktop/ test.bug.php on line 17 PHP Notice: Undefined index: first in /Users/imac/Desktop/ test.bug.php on line 20 PHP Notice: Undefined index: arr in /Users/imac/Desktop/ test.bug.php on line 21 PHP Notice: Undefined index: arr in /Users/imac/Desktop/ test.bug.php on line 22 array(0) { } PHP Notice: Undefined variable: parametre in /Users/imac/ Desktop/test.bug.php on line 29 NULL PHP Notice: Undefined variable: parametre2 in /Users/imac/ Desktop/test.bug.php on line 30 NULL PHP Notice: Undefined variable: tableau in /Users/imac/ Desktop/test.bug.php on line 31 NULL array(0) { } -- Edit bug report at http://bugs.php.net/?id=37522&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=37522&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=37522&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=37522&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=37522&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=37522&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=37522&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=37522&r=needscript Try newer version: http://bugs.php.net/fix.php?id=37522&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=37522&r=support Expected behavior: http://bugs.php.net/fix.php?id=37522&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=37522&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=37522&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=37522&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=37522&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=37522&r=dst IIS Stability: http://bugs.php.net/fix.php?id=37522&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=37522&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=37522&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=37522&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=37522&r=mysqlcfg

« previous php.bugs (#97371) next »