#36183 [NEW]: urlencode wrongly decodes %00-chars
| From: | karel at linux dot be | Date: | Fri, 27 Jan 2006 23:16:08 +0000 |
| Subject: | #36183 [NEW]: urlencode wrongly decodes %00-chars | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-92563@lists.php.net to get a copy of this message | ||
From: karel at linux dot be
Operating system: Linux
PHP version: 4.4.2
PHP Bug Type: URL related
Bug description: urlencode wrongly decodes %00-chars
Description:
------------
PHP-version: 4.3.11 (linux), and 4.4.0 (windows)
I don't know if this bug is reproducible on any higher version of PHP as I
don't have them to work on.
If you submit a POST/GET/parse_str() to a webpage, where a variable has an
URLencoded string in it, which contains %00. It will end up being mangled
totally.
Just check the reproduce-code, it'll be more clear then my explanation
here.
Reproduce code:
---------------
$comp_me = gzcompress('Compress me', 9);
parse_str( 'var='. urlencode( $comp_me ) );
var_dump( urlencode($var) );
var_dump( urlencode( $comp_me ) );
Expected result:
----------------
I would expect to see 2 urlencoded strings, EXACTLY the same.
Actual result:
--------------
string(42) "x%DAs%CE%CF-%28J-.V%C8M%05%5C0%19%BD%04%3F"
string(41) "x%DAs%CE%CF-%28J-.V%C8M%05%00%19%BD%04%3F"
---------------------------------------^^^
--
Edit bug report at http://bugs.php.net/?id=36183&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36183&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36183&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36183&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36183&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36183&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36183&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36183&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36183&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36183&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36183&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36183&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36183&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36183&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36183&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36183&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36183&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36183&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36183&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36183&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36183&r=mysqlcfg