Skip to content
Snippets Groups Projects
Commit bd61d17d authored by Neil Drumm's avatar Neil Drumm :wave:
Browse files

#68886 by myself and Steven, Handle ampersands in search queries and other...

#68886 by myself and Steven, Handle ampersands in search queries and other URLs when clean URLs are on
parent 685be2ff
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -1284,12 +1284,26 @@ function drupal_to_js($var) {
* are urlencoded() when passed through url() and do not require urlencoding()
* of individual components.
*
* Notes:
* - For esthetic reasons, we do not escape slashes. This also avoids a 'feature'
* in Apache where it 404s on any path containing '%2F'.
* - mod_rewrite's unescapes %-encoded ampersands and hashes when clean URLs
* are used, which are interpreted as delimiters by PHP. These characters are
* double escaped so PHP will still see the encoded version.
*
* @param $text
* String to encode
*/
function drupal_urlencode($text) {
if (variable_get('clean_url', '0')) {
return str_replace(array('%2F', '%26', '%23'),
array('/', '%2526', '%2523'),
urlencode($text));
}
else {
return str_replace('%2F', '/', urlencode($text));
}
}
/**
* Performs one or more XML-RPC request(s).
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment