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

Add support for "rewritten urls" in module detection #1095

Open
wants to merge 4 commits into
base: master
from

Conversation

@dweeves
Copy link

commented Apr 10, 2019

This is a fix for issue #1023 & duplicated #1093

The code adds a new method to get module information from url.
This method is first used on the actual symfony request pathinfo
if no valid module is found, then the same method is applied on the real 'PATH_INFO' (which will be the rewritten on) .

The last commit is now supporting urls without trailiing slash (/register)

dweeves and others added some commits Apr 10, 2019

@tvdijen
Copy link
Member

left a comment

I hope you don't mind, but I took care of some coding style..
We've recently put a lot of effort in this, so I'm a bit keen on it..

Besides that, this is a neat PR!
I'd like a review from the person who introduced Symfony routing before I'm willing to merge this though!

@tvdijen tvdijen requested a review from jaimeperez Apr 10, 2019

@dweeves

This comment has been minimized.

Copy link
Author

commented Jul 24, 2019

Any news on final approval ?

@tvdijen

This comment has been minimized.

Copy link
Member

commented Jul 24, 2019

Hi @dweeves !

I've asked Jaime again to take a look at this PR. I know there are several version of 'routing improvement' lying around and we need to pick a strategy here. A finalized version of the routing-feature will be part of a v1.18-release, hopefully somewhere in Q4 this year depending on resources.

@tvdijen tvdijen added this to the 1.18 milestone Jul 24, 2019

@jaimeperez
Copy link
Member

left a comment

Thanks a lot for your contribution, @dweeves!

If I understand the issue correctly, it actually lies in Symfony, and this is just a workaround. Shouldn't we try to get this fixed upstream?

Essentially, introducing an abstraction layer (offloading request parsing to Symfony, instead of using $_SERVER directly) serves a purpose, that being making it easier to test all code and increase coverage as much as possible. If we are still checking for $_SERVER['PATH_INFO'], we'll still have problems to test that code.

Note though that I'm just thinking out loud here 😅

// the path must always be on the form /module/
throw new Error\NotFound('The URL must at least contain a module name followed by a slash.');
if ($basepathinfo === '/') {
throw new Error\NotFound('No PATH_INFO to module.php');

This comment has been minimized.

Copy link
@jaimeperez

jaimeperez Jul 25, 2019

Member

This error would be shown to the end user, but won't help much, I'm afraid. Should we have an error message similar to the old one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.