Bug #66978 [Nab]: $_SERVER['REQUEST_URI'] does not contain the request's complete URI
| From: | chealer at gmail dot com | Date: | Tue, 01 Apr 2014 06:49:18 +0000 |
| Subject: | Bug #66978 [Nab]: $_SERVER['REQUEST_URI'] does not contain the request's complete URI | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-184992@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66978&edit=1
ID: 66978
User updated by: chealer at gmail dot com
Reported by: chealer at gmail dot com
Summary: $_SERVER['REQUEST_URI'] does not contain the
request's complete URI
Status: Not a bug
Type: Bug
Package: *General Issues
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
CGI doesn't specify REQUEST_URI. It may be an *environment* variable, but the only reason to
keep its value as-is would be to respect convention.
That being said, PHP has offered a stable REQUEST_URI for over a decade. It would be a big
backwards-incompatible change to ignore the past. I do not think that change is worth the cost at
this point.
As I wrote:
"This should probably be treated as a documentation bug, and just cause the $_SERVER
documentation to fix the entry description, adding a warning about the name.
However, having the actual request URI would be useful too, be it through a new
"ACTUAL_REQUEST_URI" entry, a function, or something."
Previous Comments:
------------------------------------------------------------------------
[2014-03-31 06:51:00] rasmus@php.net
So you are suggesting we rewrite the REQUEST_URI set by the server? Sorry, that is not going to
happen. This is a CGI environment variable which the web server passes to downstream applications.
We have to trust it and provide it as-is to PHP applications.
------------------------------------------------------------------------
[2014-03-31 05:39:35] chealer at gmail dot com
Servers don't magically set PHP variables. PHP may base a variable's value on data
provided by a server, but the problem remains an interpreter bug as long as a bug in the server
hasn't been identified. I don't see which bug should be filed against Apache here.
In any case, to make progress, let's start with the documentation. Have the documentation
reflect how PHP is supposed to behave, and I'll deal with eventual behavioral bugs after.
------------------------------------------------------------------------
[2014-03-28 22:56:32] rasmus@php.net
It is not a question of fixing it. PHP has nothing to do with setting the REQUEST_URI in most cases.
This is a $_SERVER variable and is set by the server. For some edge-case SAPIs we do set it, but for
the most common ones this is set by the server so if you think it is set wrong when you are running
mod_php under Apache, for example, then you need to file a bug with Apache.
------------------------------------------------------------------------
[2014-03-28 22:45:46] chealer at gmail dot com
Description:
------------
According to http://www.php.net/manual/en/reserved.variables.server.php
the REQUEST_URI entry of $_SERVER contains "The URI which was given in order to access this
page".
As reported in #55780, this is not the case, as the example given just after shows: "for
instance, '/index.html'". Actually, REQUEST_URI contains a URI reference.
This bug exists since as far as I can remember. At this point, it is probably a bad idea to simply
fix. This should probably be treated as a documentation bug, and just cause the $_SERVER
documentation to fix the entry description, adding a warning about the name.
However, having the actual request URI would be useful too, be it through a new
"ACTUAL_REQUEST_URI" entry, a function, or something.
Note: this bug is not completely PHP-specific. http://labs.apache.org/webarch/uri/rfc/rfc3986.html#hierarchical
gives a historical perspective on URI/URL terminology.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66978&edit=1