Bug #3375

PATH_INFO is empty using fastcgi / Windows

Added by Robert Lemke over 10 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Must have
Category:
MVC
Start date:
2009-05-19
Due date:
% Done:

100%

PHP Version:
Has patch:
Complexity:

Description

During the T3DD09 someone said that some parts of the routing don't work properly when using fastcgi (on Windows?) because PATH_INFO is always empty on that platform.

Please verify this and check how it can be solved.


Related issues

Related to TYPO3.Flow - Bug #3029: Routing is not working correctly on all platforms Resolved 2009-04-03

Associated revisions

Revision b99ba4ab (diff)
Added by Karsten Dambekalns over 9 years ago

[+BUGFIX] FLOW3 (Utility): The request URI is now detected correctly with PHP as Apache module as well as FastCGI (tested on Cherokee). Fixes #3029, fixes #3375.

Revision 8ea282c3 (diff)
Added by Karsten Dambekalns over 9 years ago

[+BUGFIX] FLOW3 (Utility): The request URI is now detected correctly with PHP as Apache module as well as FastCGI (tested on Cherokee). Fixes #3029, fixes #3375.

Revision 2fc8d241 (diff)
Added by Karsten Dambekalns over 9 years ago

[+API] FLOW3 (Utility): Added detectBaseUri() to Environment. Given an URI instance it tries to detect the corresponding base URI.
[+API] FLOW3 (Utility): Added getScriptRequestPath() to Environment, returns the path to the actual script request relative to the document root.
[~API] FLOW3 (Utility): Renamed getScriptRequestPathAndName() to getScriptRequestPathAndFilename() in Environment.
[~TASK] FLOW3 (MVC): Reverted recent change by Robert related to request path handling, relates to #6596
[~TASK] FLOW3 (Utility): Some more changes to getRequestUri() in Environment, relates to #6596, relates to #3029, relates to #3375.
[~TASK] FLOW3 (Resource): Make use of new getScriptRequestPath() method in FileSystemPublishingTarget.

History

#1 Updated by Robert Lemke over 10 years ago

Another thing mentioned (don't know if it's related) was that routing fails if the URI contains a "%" sign.

#2 Updated by Karsten Dambekalns over 10 years ago

The % thingy could be worked around by using this

Index: Environment.php
===================================================================
--- Environment.php    (revision 2361)
+++ Environment.php    (working copy)
@@ -200,7 +200,9 @@
      * @author Robert Lemke <robert@typo3.org>
      */
     public function getRequestURI() {
-        if (isset($this->SERVER['PATH_INFO'])) {
+        if (isset($this->SERVER['REQUEST_URI'])) {
+            $requestURIString = $this->getRequestProtocol() . '://' . $this->getHTTPHost() . $this->SERVER['REQUEST_URI'] . (strlen($this->SERVER['QUERY_STRING']) ? '?' . $this->SERVER['QUERY_STRING'] : '');
+        } elseif (isset($this->SERVER['PATH_INFO'])) {
             $requestURIString = $this->getRequestProtocol() . '://' . $this->getHTTPHost() . $this->SERVER['PATH_INFO'] . (strlen($this->SERVER['QUERY_STRING']) ? '?' . $this->SERVER['QUERY_STRING'] : '');
         } else {
             $requestURIString = $this->getRequestProtocol() . '://' . $this->getHTTPHost() . '/';

Needs more checking, though...

#3 Updated by Robert Lemke over 10 years ago

  • Target version changed from 1.0 alpha 1 to 283

#4 Updated by Robert Lemke over 10 years ago

  • Priority changed from Should have to Must have

#5 Updated by Robert Lemke over 10 years ago

  • Target version deleted (283)

#6 Updated by Karsten Dambekalns almost 10 years ago

From Marco Weber:
As far as i know there was a bug in PHP 5 with an empty PATH_INFO. But i think this bug depends on the configuration of "cgi.fix_path_info" in the php.ini. But this bug got fixed some time ago and shouldn't be in PHP5.3

My adivce would be to use REQUEST_URI on apache. In my experience it is the most reliable way. I've heard that there is no REQUEST_URI on IIS. ( Don't know what to use there... )

#7 Updated by Marco Weber almost 10 years ago

here is the link to the fixed BUG, that i was talking about:
http://bugs.php.net/bug.php?id=31892

#8 Updated by Karsten Dambekalns over 9 years ago

  • Status changed from New to Accepted
  • Assignee set to Karsten Dambekalns
  • Target version set to 1.0 alpha 8

#9 Updated by Karsten Dambekalns over 9 years ago

  • Status changed from Accepted to Resolved
  • % Done changed from 0 to 100

Applied in changeset r3833.

Also available in: Atom PDF