Say I have this route:
view_tag:
url: /tag/:tag
param: { module: tag, action: view }
What if a user tags something with "a#sign"? Calling
url_for('@view_tag?tag=a#sign');
will not produce the expected result. Since sfWebController::convertUrlStringToParameters() urlencodes the parameter I mustn't encode the parameter explicitly myself. On the other hand, if I pass the parameter without encoding it then this code from sfWebController::genUrl()
if (false !== ($pos = strpos($parameters, '#')))
{
$fragment = substr($parameters, $pos + 1);
$parameters = substr($parameters, 0, $pos);
}
will strip down the # as it'll think that "sign" is a fragment. This will produce an incorrect url.