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

Allow for the use of PATH_INFO #196

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

kennydude
Copy link

This allows for the Apache server variable, PATH_INFO to be used.

It's a small edit, but it allows for Klein to work properly in a subdirectory

This allows for the Apache server variable, PATH_INFO to be used.
Inline conditionals are not allowed
@Rican7 Rican7 self-assigned this Mar 26, 2014
@Rican7 Rican7 added this to the 2.2 milestone Jul 20, 2014
@apfritts
Copy link

+1

@Rican7
Copy link
Member

Rican7 commented Oct 23, 2014

This is a great idea!
I'm not sure why it wasn't in place before, other than that I think I was going to make it less transparent and more of a two method thing.... Hmm..

Either way, could you write a test mocking that server variable to verify that this works?

if (!$p) {
$p = $this->server->get('REQUEST_URI', '/');
}
return $p;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, a few things here:

  • You should use a variable name that has meaning, it makes it easier to read. Maybe $uri.
  • The conditional should be a bit more explicit, it should check for !empty($uri)
  • You should have new-line separation wrapping the block, so one before the if and after the closing brace

@i-am-tom
Copy link

+1, and I'll be happy to take a look in a week or two. Until then, I'm using this hack:

$req->server()->set('REQUEST_URI', $req->server()->get('PATH_INFO'));

@amrikasir
Copy link

may you see my work: #346

I hope that will help you.. thank's

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

Successfully merging this pull request may close these issues.

None yet

5 participants