Doc->Req #69409 [Opn]: urlencode() does not conform to current w3 html5 recommendations
| From: | yohgaki@php.net | Date: | Tue, 14 Apr 2015 20:45:16 +0000 |
| Subject: | Doc->Req #69409 [Opn]: urlencode() does not conform to current w3 html5 recommendations | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-192064@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69409&edit=1
ID: 69409
Updated by: yohgaki@php.net
Reported by: rainer-phpbugs at 7val dot com
Summary: urlencode() does not conform to current w3 html5
recommendations
Status: Open
-Type: Documentation Problem
+Type: Feature/Change Request
Package: URL related
Operating System: all
PHP Version: 5.6.7
Block user comment: N
Private report: N
New Comment:
urlencode() is there for compatibility. rawurlencode() does the jobs.
http://3v4l.org/L0AHV
We shouldn't have 2 similar functions in the first place, probably...
Consolidate 2 functions into one (urlencode) by having mode flag in the long run?
http_build_query() has the same issue, but it has flag for modes.
Previous Comments:
------------------------------------------------------------------------
[2015-04-09 16:35:29] rainer-phpbugs at 7val dot com
Description:
------------
---
From manual page: http://www.php.net/function.urlencode
---
urlencode() does not conform to then current w3 html5 recommendations for
application/x-www-form-urlencoded data, in that '*' (0x2A) should be left as is.
http://www.w3.org/TR/html5/forms.html#application/x-www-form-urlencoded-encoding-algorithm
If the byte is in the range 0x2A [...] Leave the byte as is.
rfc3986 would also allow '*' to be left unchangef in the query part of an URL.
http://tools.ietf.org/html/rfc3986
query = *( pchar / "/" / "?" )
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
sub-delims = "!" / "$" / "&" / "'" /
"(" / ")"
/ "*" / "+" / "," / ";" / "="
Test script:
---------------
<?php
print(urlencode('*'));
Expected result:
----------------
'*' should not be %-encoded, i.e. the test script above should not print %2A, but the
literal '*'.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69409&edit=1