note 104650 added to function.urldecode
| From: | jake at infinitylimited dot net | Date: | Tue, 28 Jun 2011 18:15:47 +0000 |
| Subject: | note 104650 added to function.urldecode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-181015@lists.php.net to get a copy of this message | ||
Having a problem with reserved HTML words in the URL being decoded.
The code in question is below:
<?php
$baseURL = "http://host/result?thing=foo"es=BAR";
$encodedURL = urlencode($baseURL);
echo "Encoded URL: $encodedURL<br>\n";
echo "URL " . urldecode($encodedURL) ."<br>\n";
?>
Results in:
Encoded URL: http%3A%2F%2Fhost%2Fresult
URL = host/result?thing=foo"es=BAR
(I removed the http:// bit to avoid confusiong with auto-formatting)
It appears that the urldecode() function is decoding %26quotes to "es first, then decoding
that to "es
I'm not sure what I"m going to do about it: perhaps escape quotes before encoding?
----
Server IP: 117.55.229.1
Probable Submitter: 209.115.153.68
----
Manual Page -- http://www.php.net/manual/en/function.urldecode.php
Edit -- https://master.php.net/note/edit/104650
Del: integrated -- https://master.php.net/note/delete/104650/integrated
Del: useless -- https://master.php.net/note/delete/104650/useless
Del: bad code -- https://master.php.net/note/delete/104650/bad+code
Del: spam -- https://master.php.net/note/delete/104650/spam
Del: non-english -- https://master.php.net/note/delete/104650/non-english
Del: in docs -- https://master.php.net/note/delete/104650/in+docs
Del: other reasons-- https://master.php.net/note/delete/104650
Reject -- https://master.php.net/note/reject/104650
Search -- https://master.php.net/manage/user-notes.php