#42647 [Opn->Bgs]: unexpected results from parse_str()
| From: | iliaa@php.net | Date: | Thu, 13 Sep 2007 12:55:13 +0000 |
| Subject: | #42647 [Opn->Bgs]: unexpected results from parse_str() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-117525@lists.php.net to get a copy of this message | ||
ID: 42647
Updated by: iliaa@php.net
Reported By: dev at glossword dot info
-Status: Open
+Status: Bogus
Bug Type: URL related
Operating System: Windows XP
PHP Version: 5.2.4
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
.
Previous Comments:
------------------------------------------------------------------------
[2007-09-13 12:47:13] dev at glossword dot info
arg1 and arg2 are stings in HTML-code taken from database.
So, there is no condition when & could be %26 because & in HTML is
&.
... a second later ...
I almost forgot to urlencode a few values. :-)
parse_url() works fine.
Bogus.
------------------------------------------------------------------------
[2007-09-13 07:54:27] jani@php.net
And & is %26..
------------------------------------------------------------------------
[2007-09-13 07:52:42] jani@php.net
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