-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix: remove deprecated upper functionality in Request::getMethod()
#8186
Conversation
25f7636
to
b38ac61
Compare
4392c3b
to
7f0ae5c
Compare
ee32c4c
to
92bab56
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am a little worried about edge cases that don't conform to the HTTP specification. However, I don't know how common it is... probably very rare.
This is a big change though.
Yes, this is a big change. |
I found this: JakeChampion/fetch#254 |
In the routes array, there is still lower case method names. |
I'm more worried about people using $this->request->getMethod() === 'post' |
I understand your concern. But it has been documented for long time. We must change the output of In the end, the question is when to fix this bug. If it is still too early, we can postpone, but what can we do in the meantime? |
I get it, believe me. I have no problem with removing depreciated code in general. Most such code is long gone and/or smoothly replaced by alternatives. Here, for a long time we had no alternatives - until the However, looking at the amount of removed depreciated code in the upcoming 4.5 - maybe it's the right time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see what others say.
system/Filters/Filters.php
Outdated
elseif (array_key_exists(strtolower($method), $this->config->methods)) { | ||
$found = true; | ||
$method = strtolower($method); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we trigger an E_USER_DEPRECATED
here when this elseif branch is executed so that users will be aware?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a big one. While we're doing this a couple of thoughts to consider if there is a case to make this part of something even bigger:
- Enums. Should our HTTP verbs be an Enum framework-wide to decrease future issues and make static analysis easier? I could also see a case for class constants.
- PSR-7. Is it time to make the few breaking changes necessary to make our HTTP layer compatible with the PSR? Instead of making this one breaking change and then others in the future it might be good to handle it all at once.
* @TODO For backward compatibility. Remove strtolower() in the future. | ||
* @deprecated 4.5.0 | ||
*/ | ||
$method = strtolower($route[0]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you go with @paulbalandan's trigger idea this would be another good place for a conditional warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@MGatner The |
42d89a2
to
fdb1d81
Compare
Co-authored-by: MGatner <[email protected]>
fdb1d81
to
4dd4218
Compare
4dd4218
to
375c340
Compare
e9e22a7
to
fe6babf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, new class looks good. We can revisit PSR-7 as needed before 4.5 goes live.
Description
The strike line is annoying.
getMethod()
get
→GET
.Checklist: