Bug #80277 [Nab]: parse_url & parse_str problems with values with percentage

From: Date: Fri, 23 Oct 2020 15:22:34 +0000
Subject: Bug #80277 [Nab]: parse_url & parse_str problems with values with percentage
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229884@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80277&edit=1 ID: 80277 User updated by: nnikolay at gmail dot com Reported by: nnikolay at gmail dot com Summary: parse_url & parse_str problems with values with percentage Status: Not a bug Type: Bug Package: URL related Operating System: Debian 10 PHP Version: 7.4.11 Assigned To: cmb Block user comment: N Private report: N New Comment: 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? Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#229884) next »