ZF-10277: Constructor code for response header analysis throws "PHP Notice: Undefined offset: 1" when instanciated with header array.

Issue Type: Bug Created: 2010-08-07T09:37:11.000+0000 Last Updated: 2010-08-08T03:35:20.000+0000 Status: Resolved Fix version(s): - 1.10.8 (25/Aug/10)

Reporter: Ralf Clau├čnitzer (zfissuetrackerralf) Assignee: Shahar Evron (shahar) Tags: - Zend_Http_Response

Related issues: Attachments:


There is no clear format for the header-array required. But the constructor will fail anyway because of a curious call to explode().

<pre class="highlight">
list($name, $value) = explode(": ", $value, 1);

From the PHP manual ([]): ??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".


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.

Have you found an issue?

See the Overview section for more details.


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

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