Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
Fix Swift_ByteStream_FileByteStream::read to match to the specification.
Browse files Browse the repository at this point in the history
  • Loading branch information
realityking committed Apr 13, 2014
1 parent 4f7a8b3 commit f497b2e
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/classes/Swift/ByteStream/FileByteStream.php
Expand Up @@ -77,7 +77,7 @@ public function getPath()
*
* @param integer $length
*
* @return string
* @return string|boolean
*
* @throws Swift_IoException
*/
Expand All @@ -93,13 +93,21 @@ public function read($length)
ini_set('magic_quotes_runtime', 1);
}
$this->_offset = ftell($fp);

// If we read one byte after reaching the end of the file
// feof() will return false and an empty string is returned
if ($bytes === '' && feof($fp)) {
$this->_resetReadHandle();

return false;
}

return $bytes;
} else {
$this->_resetReadHandle();

return false;
}

$this->_resetReadHandle();

return false;
}

/**
Expand Down

0 comments on commit f497b2e

Please sign in to comment.