From: samuel at slbdata dot se Operating system: Ubuntu 8.04.1 PHP version: 6CVS-2008-07-23 (snap) PHP Bug Type: URL related Bug description: urlencode/urldecode should use ASCII encoding
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 bug report at http://bugs.php.net/?id=45602&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45602&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45602&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45602&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45602&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45602&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45602&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45602&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45602&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45602&r=support Expected behavior: http://bugs.php.net/fix.php?id=45602&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45602&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45602&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45602&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45602&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45602&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45602&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45602&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45602&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45602&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45602&r=mysqlcfg