I just found out that PHP has a problem with %2F as well, the _SERVER
parameters contain the path_info_key, however this value has replaced
%2F to / and I think // gets replaced to / so it makes it completely
useless for retrieving parameter values with encoded slashes.
Fortunately Symfony already contained a solution, that only needed to
get forced by overruling the sfWebRequest.
I now have:
// simulate PATH_INFO BY DEFAULT,
// DON'T USE PATH_INFO_KEY FROM PHP SINCE IT HAS REPLACED %2F
TO /
// it also seem to replace // with one /
$sf_path_info_key = $this->options['path_info_key'];
if (isset($pathArray['REQUEST_URI']))
{
$script_name = $this->getScriptName();
$uri_prefix = $this->isAbsUri() ? $this->getUriPrefix() : '';
$pathInfo = preg_replace('/^'.preg_quote($uri_prefix,
'/').'/','',$pathArray['REQUEST_URI']);
$pathInfo = preg_replace('/^'.preg_quote($script_name, '/').'/',
'', $pathInfo);
$prefix_name = preg_replace('#/[^/]+$#', '', $script_name);
$pathInfo = preg_replace('/^'.preg_quote($prefix_name, '/').'/',
'', $pathInfo);
$pathInfo = preg_replace('/\??'.preg_quote($pathArray
['QUERY_STRING'], '/').'$/', '', $pathInfo);
}
in public function getPathInfo() moved to the top, since this does
return the valid pathInfo!
On 30 sep, 17:27, LvanderRee <[email protected]> wrote:
> This is an addition
> tohttp://groups.google.com/group/symfony-devs/browse_frm/thread/e23a551...
>
> but apparently I cannot add messages to it anymore...
>
> On 30 sep, 17:25, "Leon van der Ree" <[email protected]> wrote:
>
> > Hi Guys,
>
> > I bumped into this same problem. In my case I also have a slug that can
> > possibly contain a slash (depending on user input). I cannot remove the
> > slash, and I do want to get it replaced by %2F (with url_encode).
>
> > I however found not only the cause, but also the
> > solution:http://httpd.apache.org/docs/2.0/mod/core.html#allowencodedslashes
>
> > Both symfony-project.org, but also apache.org suffer from this same
> > "problem"http://www.symfony-project.org/doc/1_2%2F
> > andhttp://apache.org/foundation%2fgetinvolved.html
> > in contradiction tohttp://apache.org/foundation/getinvolved.html
>
> > The 404 is apparently by design, but also very confusing.
>
> > It can be solved by adding
> > AllowEncodedSlashes On
>
> > But why is this disabled by default?
> > Questions are still remaining, even though the solution is there...
>
> > Regards
> > Leon
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---