Skip to content
This repository was archived by the owner on May 16, 2018. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions library/Zend/Http/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -1592,6 +1592,11 @@ protected function _validateHeaderValue($value, $recurse = true)
return;
}

// Cast integers and floats to strings for purposes of header representation.
if (is_int($value) || is_float($value)) {
$value = (string) $value;
}

if (! is_string($value) && (! is_object($value) || ! method_exists($value, '__toString'))) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/is_string/is_scalar/ could be enough

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As noted in IRC, the only other scalar types we can safely cast to string are floats and integers. Booleans should not be cast.

require_once 'Zend/Http/Exception.php';
throw new Zend_Http_Exception('Invalid header value detected');
Expand Down