Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Blocker
-
Resolution: Fixed
-
Affects Version/s: 1.7.3
-
Fix Version/s: 1.8.0
-
Component/s: Zend_Controller
-
Labels:None
Description
This may be a problem with ZF, or Zend Studio or both...but it's a blocker and something should be done.
I've been using ZF for a half year now, upgrading everytime a new release is out. I used all versions since 1.5, and now when reaching 1.7.3 I ran into trouble.
Since 1.7.3 Zend_Controller_Request_Http::setRequestUri() has been changed, and now uses parse_url() on the request uri. When debugging with Zend Studio, this line (see <== PROBLEMATIC LINE below) causes a number of Warnings, and causing the headers to be already sent. All new versions (1.7.4 and 1.7.5) also have the same problem.
The debugging URL Zend Studio constructs is the following:
And this fails on the parse_url() line.
As I said, this may not be a bug, but it's a blocker for me, being stuck at version 1.7.2, and not being able to upgrade.
New problematic code:
public function setRequestUri($requestUri = null) { if ($requestUri === null) { if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // check this first so IIS will catch $requestUri = $_SERVER['HTTP_X_REWRITE_URL']; } elseif (isset($_SERVER['REQUEST_URI'])) { $requestUri = $_SERVER['REQUEST_URI']; if (isset($_SERVER['HTTP_HOST']) && strstr($requestUri, $_SERVER['HTTP_HOST'])) { $pathInfo = parse_url($requestUri, PHP_URL_PATH); // <== PROBLEMATIC LINE $queryString = parse_url($requestUri, PHP_URL_QUERY); $requestUri = $pathInfo . ((empty($queryString)) ? '' : '?' . $queryString); } } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { // IIS 5.0, PHP as CGI $requestUri = $_SERVER['ORIG_PATH_INFO']; if (!empty($_SERVER['QUERY_STRING'])) { $requestUri .= '?' . $_SERVER['QUERY_STRING']; } } else { return $this; } } elseif (!is_string($requestUri)) { return $this; } else { // Set GET items, if available if (false !== ($pos = strpos($requestUri, '?'))) { // Get key => value pairs and set $_GET $query = substr($requestUri, $pos + 1); parse_str($query, $vars); $this->setQuery($vars); } } $this->_requestUri = $requestUri; return $this; }
Old working code:
public function setRequestUri($requestUri = null) { if ($requestUri === null) { if (isset($_SERVER['HTTP_X_REWRITE_URL'])) { // check this first so IIS will catch $requestUri = $_SERVER['HTTP_X_REWRITE_URL']; } elseif (isset($_SERVER['REQUEST_URI'])) { $requestUri = $_SERVER['REQUEST_URI']; if (isset($_SERVER['HTTP_HOST']) && strstr($requestUri, $_SERVER['HTTP_HOST'])) { $requestUri = preg_replace('#^[^:]*://[^/]*/#', '/', $requestUri); // <== ORIGINAL LINE } } elseif (isset($_SERVER['ORIG_PATH_INFO'])) { // IIS 5.0, PHP as CGI $requestUri = $_SERVER['ORIG_PATH_INFO']; if (!empty($_SERVER['QUERY_STRING'])) { $requestUri .= '?' . $_SERVER['QUERY_STRING']; } } else { return $this; } } elseif (!is_string($requestUri)) { return $this; } else { // Set GET items, if available if (false !== ($pos = strpos($requestUri, '?'))) { // Get key => value pairs and set $_GET $query = substr($requestUri, $pos + 1); parse_str($query, $vars); $this->setQuery($vars); } } $this->_requestUri = $requestUri; return $this; }
Is the debugging URL you provided the one that causes the failure, or some other URL?