php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #45968 urlencode with a safe paremeter
Submitted: 2008-09-02 07:58 UTC Modified: 2016-12-31 00:28 UTC
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: info at marcel-schlesinger dot de Assigned:
Status: Open Package: URL related
PHP Version: 6CVS-2008-09-02 (snap) OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-09-02 07:58 UTC] info at marcel-schlesinger dot de
Description:
------------
I looked myself and determined that the RFC3986 is very spongelike. Compared with other programming languages I noticed that everyone differently converts the RFC.
In Python there is a nice feature, that you can tell wich chars have to be safe urllib.quote(s, safe='~'). All chars except this one in the safe parameter are escaped.
With PHP you could do this only with a search & replace function which isn't very nice.
So i want to suggest, to add likewise one more parameter to the urlencode function.

Expected result:
----------------
echo urlencode("Test str \"'.-/", array('\'', '"'));

output:
Test+str+"'%2E%2D%2F

======

echo rawurlencode("Test str \"'.-/", array('\'', '"'));

output:
Test%20str%20"'%2E%2D%2F

Actual result:
--------------
echo urlencode("Test str \"'.-/");

output:
Test+str+%22%27.-%2F

======

echo rawurlencode("Test str \"'.-/");

output:
Test%20str%20%22%27.-%2F

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-12-31 00:28 UTC] cmb@php.net
-Package: Feature/Change Request +Package: URL related
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sat Feb 16 07:01:25 2019 UTC