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

Subfolder base_url() with parameter #2574

Merged
merged 2 commits into from
Feb 21, 2020

Conversation

MGatner
Copy link
Member

@MGatner MGatner commented Feb 18, 2020

Description
Currently when providing a URI parameter to base_url() if it has a preceding slash it will cause the resulting URL to be relative to the root domain, rather than a subfolder defined in app.baseUrl. This PR trims preceding and trailing slashes in the helper to ensure the result from HTTP\URI is still relative to the base URL.

May fix some of #2445, hard to say without being able to replicate.

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@MGatner MGatner requested a review from lonnieezell February 18, 2020 20:36
@MGatner
Copy link
Member Author

MGatner commented Feb 18, 2020

@lonnieezell Need your ruling on this. IMO the test has a logic fallacy, because base_url() should always be relative to, well, the base URL (which might include a subfolder) whereas uri_string()
should always be absolute to the domain root. If that's the case let me know and I'll remove that portion of the test; otherwise I think we have some other changes to make...

@lonnieezell
Copy link
Member

I would agree with your logic here. I think it might cause unexpected results for some people that develop in a subfolder then push it to a site without, or vice-versa, but I don't think there's any good way to make that work for them.

@MGatner
Copy link
Member Author

MGatner commented Feb 20, 2020

Sounds good. I’ll remove those test scenarios and try it again.

@lonnieezell lonnieezell merged commit 481d573 into codeigniter4:develop Feb 21, 2020
@MGatner MGatner deleted the baseurl-trailing branch February 21, 2020 11:55
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

Successfully merging this pull request may close these issues.

2 participants