ID: 42647
Updated by: [EMAIL PROTECTED]
Reported By: dev at glossword dot info
Status: Feedback
Bug Type: URL related
Operating System: Windows XP
PHP Version: 5.2.4
New Comment:
And & is %26..
Previous Comments:
------------------------------------------------------------------------
[2007-09-13 07:52:42] [EMAIL PROTECTED]
My question is, how do you pass something like that via an URL?
(space is usually + IIRC.. :)
------------------------------------------------------------------------
[2007-09-12 18:40:41] dev at glossword dot info
Oh, as for $array3 and $array4 - it is correct. $array2 is partially
correct.
------------------------------------------------------------------------
[2007-09-12 18:27:58] dev at glossword dot info
Description:
------------
Hi. Before to make this post, I have read all previous bugs related to
`parse_str()` and user comments in documentation for `parse_str()`
function. Perhaps, this is not a bug but "consistent behavior"...
Anyway, it didn't work as expected and it makes a trouble for me.
Reproduce code:
---------------
$str1 = '&arg1=123&arg2="Company&Sons" '90';
$str2 = '&arg1=123&arg2="Company&Sons" \'90';
parse_str($str1, $array1);
parse_str( html_entity_decode($str1), $array2 );
parse_str($str2, $array3);
parse_str( html_entity_decode($str2), $array4 );
print_r( $array1 );
print_r( $array2 );
print_r( $array3 );
print_r( $array4 );
Expected result:
----------------
Array
(
[arg1] => 123
[arg2] => "Company&Sons" '90
)
Array
(
[arg1] => 123
[arg2] => "Company&Sons" '90
)
...
Actual result:
--------------
Array
(
[arg1] => 123
[arg2] =>
[quot;Company] =>
[amp;Sons] =>
[quot;_] =>
[#039;90] =>
)
Array
(
[arg1] => 123
[arg2] => "Company
[Sons"_] =>
[#039;90] =>
)
Array
(
[arg1] => 123
[arg2] => "Company
[Sons"_'90] =>
)
Array
(
[arg1] => 123
[arg2] => "Company
[Sons"_'90] =>
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42647&edit=1