ID: 37522
Updated by: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
-Status: Open
+Status: Feedback
Bug Type: Strings related
Operating System: osx
PHP Version: 5.1.4
New Comment:
Works perfectly fine here.
I get the expected result with 5.1.4, 5.2.0-CVS and 4.4.3-CVS.
Previous Comments:
------------------------------------------------------------------------
[2006-05-19 18:23:15] [EMAIL PROTECTED]
OK, this bug is related to #24208.
It actually fails the test (from make test).
------------------------------------------------------------------------
[2006-05-19 18:22:13] [EMAIL PROTECTED]
register_globals fixed the problem for the first part
(parse_str with 1 argument). This means the doc should reflect
it.
parse_str with 2 arguments still holds...
------------------------------------------------------------------------
[2006-05-19 17:33:10] [EMAIL PROTECTED]
I can't reproduce on Linux with 5.1 nor with 5.2
------------------------------------------------------------------------
[2006-05-19 16:30:50] [EMAIL PROTECTED]
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 this bug report at http://bugs.php.net/?id=37522&edit=1