-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
REQUEST_TIME/REQUEST_TIME_FLOAT missing in INPUT_SERVER #17543
Comments
This is not a bug, the There is a note about this in the documentation for |
The docs say:
REQUEST_TIME/REQUEST_TIME_FLOAT are not set by the user but by PHP.
If the time is not set by the SAPI, it also means that the time reported isn't correct, since the start time is only set after the SAPI is started which can be multiple ms after the request started being handled by PHP - which would be a separate bug then. |
See e.g. Lines 316 to 348 in bd23d3a
We register some variables for ext/filter explicitly. Adding |
I have put the various |
Ah, okay, makes sense to me. Thank you! |
@Girgias actually the Therefore obviously also EDIT:
Actually this isn't what these do at all/these are used for. What exactly is odd or confusing? |
Well, the question is, do we want to keep a duplicate set of input parameters so users can work around the framework of their choice? |
It's not only about working around the framework but also about ensuring data is untampered with. With filter_input I just need to verify compliance of the SAPI and PHP core, when using the superglobals I suddenly have to check and verify compliance at all places that use or possibly change any of the superglobals. In fact, I would go a step further and deprecate the superglobals instead, since that was a design mistake to begin with and keep only filter_input. (never going to happen of course) |
Okay, but this is not the best place to discuss this. More appropriate would be the Internals list. Either we deprecate filter_input() and related functionality, or we should fully support it. @Girgias, did you already write to internals about the deprecation (couldn't find anything). |
@cmb69 I did not write anything to internals, as we normally start discussion for the mass deprecation RFC around April/May. If the framework (e.g. WordPress) tampers with the superglobal they must have a good reason for doing this, and thus being able to access the untampered superglobals seems to be defeating the point of the framework. If WP is doing something that it shouldn't be doing, this should be brought to WP IMHO. The filter extension is extremely clunky and has so many edge cases that if I could do swooping changes just on my own I would be unbundling from php-src rather than removing support for the superglobals. |
Regarding WP, see https://wpartisan.me/tutorials/wordpress-auto-adds-slashes-post-get-request-cookie (not sure if that still applies, but apparently it does). Anyway, I think @kkmuffme made a good point (emphasis mine):
Say, if you have a plugin system, a plugin could change the superglobals at will, and besides Anyway, I think we should discuss this topic on internals. If you don't mind, I'll send a mail. |
Feel free, but I still doubt the usefulness of this. For POST/GET PSR-7 interfaces/objects seem like the "obvious" fix. Cookies and environment variables I don't really see the point of using the raw SAPI variables as surely any plugin that adds or remove to them does it for a purpose. And the server variables should just be read only, but again if a plugin tampers with them there surely is a point in doing so. |
This should be re-open - REQUEST_TIME/REQUEST_TIME_FLOAT are set by SAPI and they should be probably supported |
Description
The following code:
Resulted in this output:
But I expected this output instead:
These are the only 2 documented in https://www.php.net/manual/en/reserved.variables.server.php with that behavior? Is this a bug?
I only encountered this behavior with other (non-documented) variables
HOME
andUSER
PHP Version
PHP 8.4
Operating System
No response
The text was updated successfully, but these errors were encountered: