ZF-5520: Failing to get location header from PHP script hosted on Windows IIS 6
Description
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)) {
With:
if (preg_match("|^([\w-]+):\s*(.+)|", $line, $m)) {
(Making the space optional)
Thanks Tom
Comments
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: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
Posted by Shahar Evron (shahar) on 2010-07-13T09:07:46.000+0000
Merged to 1.10 release branch in r22555.