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

Commit

Permalink
fixed infinite loop
Browse files Browse the repository at this point in the history
  • Loading branch information
fabpot committed May 7, 2014
1 parent 4f7a8b3 commit d9ba6c0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/classes/Swift/Transport/StreamBuffer.php
Expand Up @@ -233,9 +233,14 @@ protected function _commit($bytes)
$totalBytesWritten = 0;

while ($totalBytesWritten < $bytesToWrite) {
$bytesWriten = fwrite($this->_in, substr($bytes, $totalBytesWritten));
$totalBytesWritten += $bytesWriten;
$bytesWritten = fwrite($this->_in, substr($bytes, $totalBytesWritten));
if (false === $bytesWritten || 0 === $bytesWritten) {
break;
}

$totalBytesWritten += $bytesWritten;
}

if ($totalBytesWritten > 0) {
return ++$this->_sequence;
}
Expand Down

0 comments on commit d9ba6c0

Please sign in to comment.