I've found interesting behavior during redirect with drupal_goto. My site has a page "search" and gets parameter "keys" which can contain "&" sign. After redirecting on that page with:

$params['keys'] = 'test & test';
drupal_goto('search', $params);

The search page gets the key value equals to "test %26 test". I've reviewed the core and found that drupal_goto uses url function which in turn uses drupal_urlencode where the problem lies:

    return str_replace(array('%2F', '%26', '%23', '//'),
                       array('/', '%2526', '%2523', '/%252F'),
                       rawurlencode($text));

If I remove replacement of '%26' to '%2526', the code works as expected.

It looks like a bug, any thoughts?

Comments

gianfrasoft’s picture

I used PHP header function instead...

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.