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

Routing: methods must be in uppercase since v4 ?! #3006

Closed
snoopy72 opened this issue Oct 4, 2020 · 4 comments
Closed

Routing: methods must be in uppercase since v4 ?! #3006

snoopy72 opened this issue Oct 4, 2020 · 4 comments

Comments

@snoopy72
Copy link

snoopy72 commented Oct 4, 2020

slim v3: working without problems:

$app->map(array("get","post"), "/test", "TestController:test")->setName("test");

slim v4: error

$app->map(array("get","post"), "/test", "TestController:test")->setName("test");

Solution: "simply" change all methods to uppercase

$app->map(array("GET","POST"), "/test", "TestController:test")->setName("test");

WHY ?!

that is an array of strings and it does not mapper, if strings are case-sensivtive for this part.
we have thousands of routes (and no, there is no way to bundle them, it's just a big and complex app) and we use UPPERCASE only for const and defined values ... not for string arrays.

2nd reason, why we are not quiclly able to change all to UPPERCASE: some automatic procedures, which are documenting our sources, have to be changed and that would brings lot more work for us. we changes the map function in the slim sources to accept lower strings and there seems not be any problems. so, why has this be changed ?

pls change that back to enable us, using slim in future.

@l0gicgate
Copy link
Member

FastRoute handles route matching. You can go complain over on that repo.

I suggest that you change your tone. It's rather abrasive.

@snoopy72
Copy link
Author

snoopy72 commented Oct 4, 2020

I suggest that you change your documentation and way of upgrading. It's really frustrating and annoying.

@snoopy72
Copy link
Author

snoopy72 commented Oct 4, 2020

btw: FastRoute did not change (v1.3.0 in both systems).

It's your code (vendor/slim/slim/Slim/Routing/RouteCollector.php) which seems to be responsible for this problem.

Pointing the finger is easy ... the "map" function is defined in your source.

@odan
Copy link
Contributor

odan commented Oct 4, 2020

Hi @snoopy72 I have checked the Slim 3, 4 and FastRoute documetation about this specific parameter.

v3: http://www.slimframework.com/docs/v3/objects/router.html#custom-route
v4: http://www.slimframework.com/docs/v4/objects/routing.html#custom-route
Fastroute: https://github.com/nikic/FastRoute#defining-routes

All pages shows that the HTTP method name must be written in UPPERCASE.

Slim 3:

$app->map(['GET', 'POST'], '/books', function ($request, $response, $args) {
    // ...
});

Slim 4:

$app->map(['GET', 'POST'], '/books', function ($request, $response, $args) {
    // ...
});

Fastroute:

$r->addRoute(['GET', 'POST'], '/test', 'handler');

we use UPPERCASE only for const and defined values ... not for string arrays.

Just because this "rule" applies to your company or solution does not mean that this rule applies equally to everyone else out there, and certainly not to libraries or frameworks.

change that back to enable us, using slim in future.

I think lowercase for the HTTP methods was never so documented and officially supported.
The documentation is not perfect, but in this case it looks quite correct to me.

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

3 participants