Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slim 3 getPath in subdirectory missing left most slash #1724

Closed
geggleto opened this issue Jan 7, 2016 · 3 comments
Closed

Slim 3 getPath in subdirectory missing left most slash #1724

geggleto opened this issue Jan 7, 2016 · 3 comments

Comments

@geggleto
Copy link
Member

geggleto commented Jan 7, 2016

Example:
https://gist.github.com/geggleto/6cc2d792305fefc2bf64

http://dev/slim3/develop-testbed/public/yes/no => yes/no
http://develop-testbed.slim3.dev/yes/no => /yes/no

getPath is getting ltrim'd somewhere.

@akrabat
Copy link
Member

akrabat commented Jan 7, 2016

This is intentional. If the leading / is missing, then the base path is set.

@geggleto geggleto closed this as completed Jan 7, 2016
@tuupola
Copy link
Contributor

tuupola commented Jan 8, 2016

Same as #1554.

Even though intentional it still is confusing for me that behaviour is different depending on whether Slim is installed in subfolder or not. I guess there will be lots of bug reports and support requests about this. In the end I just ended up doing something like following:

$path = "/" . $request->getUri()->getPath();
$path = str_replace("//", "/", $path);

@alexweissman
Copy link

If the leading / is missing, then the base path is set.

Do you mean "base path is set" -> "leading / will be stripped"?

Also, what is the motivation behind this behavior? Is this part of PSR-7?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants