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


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:http://www.google.com/'); 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: http://www.google.com/'); 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


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

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

Implemented via r22261

Merged to 1.10 release branch in r22555.