php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45602 urlencode/urldecode should use ASCII encoding
Submitted: 2008-07-23 11:44 UTC Modified: 2010-06-21 02:13 UTC
Votes:5
Avg. Score:3.8 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: samuel at slbdata dot se Assigned:
Status: Wont fix Package: URL related
PHP Version: 6CVS-2008-07-23 (snap) OS: Ubuntu 8.04.1
Private report: No CVE-ID: None
 [2008-07-23 11:44 UTC] samuel at slbdata dot se
Description:
------------
The "URL Generic Syntax" specification (RFC 2396) says that URLs must be US-ASCII. However, the PHP urlencode/decode functions return/accept binary data only. I think the correct behaviour would be to use Unicode (which is a superset of ASCII) for the encoded values.

(This might affect some other URL-related functions, but urlencode/urldecode are the only ones that I know)

See also bug 45566 . Since it's quite likely for urldecode's input to come from the $_SERVER superglobal, I think either both or none of the bugs should be fixed.


Reproduce code:
---------------
<?php
echo urldecode("%50%48%50\n");

Expected result:
----------------
PHP

Actual result:
--------------
PHP Warning:  urldecode() expects parameter 1 to be strictly a binary string, Unicode string given in - on line 3

Warning: urldecode() expects parameter 1 to be strictly a binary string, Unicode string given in - on line 3


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-31 23:12 UTC] jani@php.net
See also bug #45566 (you missed the hash there :)
 [2010-06-21 02:13 UTC] felipe@php.net
-Status: Open +Status: Wont fix
 [2010-06-21 02:13 UTC] felipe@php.net
Old trunk related.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC