ZF-10277: Constructor code for response header analysis throws "PHP Notice: Undefined offset: 1" when instanciated with header array.
Description
There is no clear format for the header-array required. But the constructor will fail anyway because of a curious call to explode().
list($name, $value) = explode(": ", $value, 1);
From the PHP manual ([http://www.php.net/manual/en/function.explode.php]): ??If limit is set and positive, the returned array will contain a maximum of limit elements with the last element containing the rest of string.??
With the limit-parameter set to one explode() will always return an array having exactly one element. The list-keyword on the left side of the assignment expects two elements. Thus, no matter what $value contains this will issue PHP to complaining with "Undefined offset: 1".
Comments
Posted by Shahar Evron (shahar) on 2010-08-08T03:35:19.000+0000
Good catch (looks like it has been a bug for years...). Fixed in trunk in r. 22810 and in release-1.10 in r. 22811. Will be included in the next release.
Also, added a couple of unit tests.