From 8a68ec7c25964ab35a2feba7875bf162858eba6c Mon Sep 17 00:00:00 2001 From: Alex Denvir Date: Wed, 12 Dec 2012 10:40:37 +0000 Subject: [PATCH 1/2] Alter Zend\Http\Client getStream to return streamName if it has been set Remove second fopen from send() --- library/Zend/Http/Client.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/Zend/Http/Client.php b/library/Zend/Http/Client.php index 9b92f7a6d2a..fc735642f3c 100644 --- a/library/Zend/Http/Client.php +++ b/library/Zend/Http/Client.php @@ -582,6 +582,10 @@ public function setStream($streamfile = true) */ public function getStream() { + if (!is_null($this->streamName)) { + return $this->streamName; + } + return $this->config['outputstream']; } @@ -834,10 +838,6 @@ public function send(Request $request = null) if (!is_resource($stream) && is_string($stream)) { $stream = fopen($stream, 'r'); } - if (!is_resource($stream)) { - $stream = $this->getUri()->toString(); - $stream = fopen($stream, 'r'); - } $streamMetaData = stream_get_meta_data($stream); if ($streamMetaData['seekable']) { rewind($stream); From 66c1dc785d07ef1e9ebdcfabd11d1f83bdebb1ef Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Thu, 13 Dec 2012 10:08:51 -0600 Subject: [PATCH 2/2] Fixed an issue leading to a fatal error in online tests - gzinflate() raises an E_WARNING on failure, which would cause PHPUnit to halt. Wrapped with ErrorHandler. --- library/Zend/Http/Response.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/library/Zend/Http/Response.php b/library/Zend/Http/Response.php index 539af7f7e26..0f6c8e3fed2 100644 --- a/library/Zend/Http/Response.php +++ b/library/Zend/Http/Response.php @@ -10,6 +10,7 @@ namespace Zend\Http; +use Zend\Stdlib\ErrorHandler; use Zend\Stdlib\ResponseInterface; /** @@ -476,7 +477,17 @@ protected function decodeGzip($body) ); } - return gzinflate(substr($body, 10)); + ErrorHandler::start(); + $return = gzinflate(substr($body, 10)); + $test = ErrorHandler::stop(); + if ($test) { + throw new Exception\RuntimeException( + 'Error occurred during gzip inflation', + 0, + $test + ); + } + return $return; } /**