Zend Framework

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

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.10.7
  • Fix Version/s: 1.10.8
  • Component/s: Zend_Http_Response
  • Labels:
    None

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".

Activity

Hide
Shahar Evron added a comment -

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.

Show
Shahar Evron added a comment - 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.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: