#45602 [Opn]: urlencode/urldecode should use ASCII encoding
| From: | jani@php.net | Date: | Thu, 31 Jul 2008 23:12:27 +0000 |
| Subject: | #45602 [Opn]: urlencode/urldecode should use ASCII encoding | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-127461@lists.php.net to get a copy of this message | ||
ID: 45602
Updated by: jani@php.net
Reported By: samuel at slbdata dot se
Status: Open
Bug Type: URL related
Operating System: Ubuntu 8.04.1
PHP Version: 6CVS-2008-07-23 (snap)
New Comment:
See also bug #45566 (you missed the hash there :)
Previous Comments:
------------------------------------------------------------------------
[2008-07-23 11:44:14] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=45602&edit=1