ZF-5520: Failing to get location header from PHP script hosted on Windows IIS 6

Issue Type: Bug Created: 2009-01-11T14:52:03.000+0000 Last Updated: 2010-07-13T09:07:47.000+0000 Status: Resolved Fix version(s): Reporter: Tom Holder (tholder) Assignee: Wil Moore III (wilmoore) (wilmoore) Tags: - Zend_Http_Client

Related issues: - ZF-9834



Ok, this one took me ages to track down.

On IIS running PHP 5.2.8 (also believe the problem exists when using 5.2.2) with FastCGI or ISAPI Module... using the following causes Zend Framework to miss the Location header:

header('Location:'); exit();

The above will work when served from an Apache PHP server but not on IIS 6/PHP. The following quick fix will solve it:

header('Location:'); exit();

(Note the space)

I would suggest the following fix. In Http/Response.php line 500 of the extract header function, replace:

if (preg_match("|^([\w-]+):\s+(.+)|", $line, $m)) {


if (preg_match("|^([\w-]+):\s*(.+)|", $line, $m)) {

(Making the space optional)

Thanks Tom


Posted by Tom Holder (tholder) on 2009-02-23T06:47:34.000+0000

I notice this has still not been fixed in the latest version of Zend.

Posted by Wil Moore III (wilmoore) (wilmoore) on 2010-05-23T00:27:15.000+0000

adjusted regex to add ability to find headers like 'Location:' (no space after colon) in addition to the current 'Location:'. Includes 1 unit test with two assertions.

Implemented via r22261

Posted by Shahar Evron (shahar) on 2010-07-13T09:07:46.000+0000

Merged to 1.10 release branch in r22555.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.