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

Dont replace slashes with backslashes in the to route #1839

Merged
merged 2 commits into from
Mar 22, 2019
Merged

Dont replace slashes with backslashes in the to route #1839

merged 2 commits into from
Mar 22, 2019

Conversation

bintzandt
Copy link
Contributor

Fixes #1838

Description
Remove the replacement of / with \ in the $to part of routes. This ensures that routes like $routes->add('blog/joe', 'Blogs::users/34'); will work.

Checklist:

  • Securely signed commits
  • Conforms to style guide

@lonnieezell
Copy link
Member

That might fix that specific problem, but makes it impossible to find controllers in subdirectories and map them to a namespace.

It looks like we need to split the $to segment on the double-colons and do that conversion on the left side only. That way it leaves things alone and everything should still work.

@bintzandt
Copy link
Contributor Author

Yeah, I ran into that already.

I have updated the PR so that the slashes are only replaced in the controller part of $val. I have used array destructuring, which is only supported in PHP >= 7.1 but I don't think that is a problem since Codeigniter 4 only supports PHP >= 7.2.

This should fix the problem and still allow Codeigniter to find controllers in subdirectories.

Let me know!

@lonnieezell lonnieezell merged commit f5563e6 into codeigniter4:develop Mar 22, 2019
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