Symfony 1.4: Is it possible to prevent escaping of a redirect URL?

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-04-06T19:24:57Z Indexed on 2010/04/06 22:43 UTC
Read the original article Hit count: 257

Filed under:
|
|
|
|

Hi,

If I do a redirect in action as normal:

$this->redirect('@mypage?apple=1&banana=2&orange=3');

... Symfony produces the correct URL:

/something/something?apple=1&banana=2&orange=3

However, the following gets escaped for some bizarre reason:

$string = 'apple=1&banana=2&orange=3';
$this->redirect('@mypage?'.$string);

... and the following URL is produced:

/something/something?apple=1&banana=2&orange=3

Is there a way to avoid this escaping and have the ampersands appear correctly in the URL? I've tried everything I can think of and it's driving me mad. I need this for a situation where I'm pulling a saved query as a string from the database and would just like to latch it onto the URL. I'm aware that I could generate an array from the string and then generate a brand new URL from the array, but it just seems like a lot of overhead because of this silly escaping.

Thanks.

© Stack Overflow or respective owner

Related posts about symfony

Related posts about url