diff -r 8d50c48361b8 -r ba5f4046635b web/lib/Zend/Service/Amazon/S3/Stream.php --- a/web/lib/Zend/Service/Amazon/S3/Stream.php Fri Mar 22 10:44:46 2013 +0100 +++ b/web/lib/Zend/Service/Amazon/S3/Stream.php Fri Mar 22 10:47:04 2013 +0100 @@ -15,9 +15,9 @@ * @category Zend * @package Zend_Service * @subpackage Amazon_S3 - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License - * @version $Id: Stream.php 22621 2010-07-18 00:35:48Z torio $ + * @version $Id: Stream.php 24593 2012-01-05 20:35:02Z matthew $ */ /** @@ -31,7 +31,7 @@ * @category Zend * @package Zend_Service * @subpackage Amazon_S3 - * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_Service_Amazon_S3_Stream @@ -140,8 +140,7 @@ $this->_writeBuffer = true; $this->_getS3Client($path); return true; - } - else { + } else { // Otherwise, just see if the file exists or not $info = $this->_getS3Client($path)->getInfo($name); if ($info) { @@ -175,9 +174,9 @@ /** * Read from the stream * - * http://bugs.php.net/21641 - stream_read() is always passed PHP's - * internal read buffer size (8192) no matter what is passed as $count - * parameter to fread(). + * http://bugs.php.net/21641 - stream_read() is always passed PHP's + * internal read buffer size (8192) no matter what is passed as $count + * parameter to fread(). * * @param integer $count * @return string @@ -194,14 +193,12 @@ } $range_start = $this->_position; - $range_end = $this->_position+$count; + $range_end = $this->_position + $count - 1; // Only fetch more data from S3 if we haven't fetched any data yet (postion=0) - // OR, the range end position is greater than the size of the current object - // buffer AND if the range end position is less than or equal to the object's - // size returned by S3 - if (($this->_position == 0) || (($range_end > strlen($this->_objectBuffer)) && ($range_end <= $this->_objectSize))) { - + // OR, the range end position plus 1 is greater than the size of the current + // object buffer + if ($this->_objectBuffer === null || $range_end >= strlen($this->_objectBuffer)) { $headers = array( 'Range' => "bytes=$range_start-$range_end" );