Skip to content
This repository was archived by the owner on May 16, 2018. It is now read-only.

Zend_Http_Client Header with integer value throws exception #566

Closed
cliffordwhansen opened this issue May 19, 2015 · 3 comments
Closed

Zend_Http_Client Header with integer value throws exception #566

cliffordwhansen opened this issue May 19, 2015 · 3 comments

Comments

@cliffordwhansen
Copy link

I just updated to 1.12.12 using composer and got the following error:
Fatal error: Uncaught exception 'Zend_Http_Exception' with message 'Invalid header value detected' in /vagrant/vendor/zendframework/zendframework1/library/Zend/Http/Client.php on line 1597

After some debugging I found the following fixes it

diff --git a/library/Zend/Http/Client.php b/library/Zend/Http/Client.php
index 279556a..acbbb33 100644
--- a/library/Zend/Http/Client.php
+++ b/library/Zend/Http/Client.php
@@ -1592,7 +1592,7 @@ class Zend_Http_Client
             return;
         }

-        if (! is_string($value) && (! is_object($value) || ! method_exists($value, '__toString'))) {
+        if (!(is_string($value)||is_integer($value)) && (! is_object($value) || ! method_exists($value, '__toString'))) {
             require_once 'Zend/Http/Exception.php';
             throw new Zend_Http_Exception('Invalid header value detected');
         }

My PHP version.

$ php -v
PHP 5.5.24-1+deb.sury.org~trusty+1 (cli) (built: May  2 2015 09:47:33) 
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
    with Xdebug v2.3.2, Copyright (c) 2002-2015, by Derick Rethans
@dirmax
Copy link

dirmax commented May 20, 2015

Hotfix!!!
replace string 1595
from: if (! is_string($value) && (! is_object($value) || ! method_exists($value, '__toString'))) {
to: if (! is_string($value) && ! is_numeric($value) && (! is_object($value) || ! method_exists($value, '__toString'))) {

P.S. Who make pull request? )

@akrabat
Copy link
Contributor

akrabat commented May 20, 2015

PR #567 is ready to go. Hopefully we'll roll out 1.12.13 later today.

@froschdesign
Copy link
Member

Fixed with #567

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants