Edit report at https://bugs.php.net/bug.php?id=80277&edit=1
ID: 80277
Updated by: cmb@php.net
Reported by: nnikolay at gmail dot com
Summary: parse_url & parse_str problems with values with
percentage
-Status: Not a bug
+Status: Open
Type: Bug
Package: URL related
Operating System: Debian 10
PHP Version: 7.4.11
-Assigned To: cmb
+Assigned To:
Block user comment: N
Private report: N
New Comment:
> But this makes nonsense!
If you say so.
Previous Comments:
------------------------------------------------------------------------
[2020-10-23 15:22:34] nnikolay at gmail dot com
But this makes nonsense! Why should I convert the "%" to "%25" before I gave it
to the function parse_url? Why the function parse_url & parse_str do not make it? If this is so,
why I should not convert "&" to "%26" and all the other characters?
------------------------------------------------------------------------
[2020-10-23 15:09:54] cmb@php.net
Percent characters in an URI introduce a percent-encoded[1]
character, and parse_url() and parse_str() interpret it as such.
A literal percent character would have to be written as %25 in an
URI, see <https://3v4l.org/2C3Bo>.
[1] <https://en.wikipedia.org/wiki/Percent-encoding>
------------------------------------------------------------------------
[2020-10-23 14:37:07] nnikolay at gmail dot com
Description:
------------
parse_url & parse_str have problems, when in the URL is some value with percent in the form:
domain.com/?campaignid=%campaignid%&adid=%bannerid%
Then both of them are converting the "%" in some unicode, which breaks the code:
array(4) {
["scheme"]=>
string(5) "https"
["host"]=>
string(19) "domain"
["path"]=>
string(16) "/path/"
["query"]=>
array(6) {
["campaignid"]=>
string(10) "�mpaignid%"
["adid"]=>
string(8) "�nnerid%"
}
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80277&edit=1