Req #72418 [NEW]: Special characters should be escaped as described in RFC in http_build_query
| From: | thflori at gmail dot com | Date: | Wed, 15 Jun 2016 16:08:38 +0000 |
| Subject: | Req #72418 [NEW]: Special characters should be escaped as described in RFC in http_build_query | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-201660@lists.php.net to get a copy of this message | ||
From: thflori at gmail dot com
Operating system: Linux 4.4
PHP version: 5.6.22
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Special characters should be escaped as described in RFC in http_build_query
Description:
------------
---
From manual page: http://www.php.net/function.http-build-query
---
The function http_build_query encodes special charaters that don't need
to be encoded.
The problem here is that the query might get bigger than it has to be.
According to the RFC 1738 document mentioned in the manual these
characters don't have to be encoded:
> Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
> reserved characters used for their reserved purposes may be used
> unencoded within a URL.
Test script:
---------------
var_dump(http_build_query(['a' => '$-_.+!*\'(),']));
Expected result:
----------------
string(13) "a=$-_.+!*'(),"
Actual result:
--------------
string(29) "a=%24-_.%2B%21%2A%27%28%29%2C"
--
Edit bug report at https://bugs.php.net/bug.php?id=72418&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72418&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72418&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72418&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72418&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72418&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72418&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72418&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72418&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72418&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72418&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72418&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72418&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72418&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72418&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72418&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72418&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72418&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72418&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72418&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72418&r=mysqlcfg