mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixing CakeSocket::write() to better work with fwrite() oddities
where fwrite() won't actually write all the content, instead only part of the content would be written. All content should be written now. Fixes #1616
This commit is contained in:
parent
548a64e63b
commit
7d15c9d93a
1 changed files with 8 additions and 2 deletions
|
@ -212,8 +212,14 @@ class CakeSocket extends Object {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return fwrite($this->connection, $data, strlen($data));
|
||||
$totalBytes = strlen($data);
|
||||
for ($written = 0, $rv = 0; $written < $totalBytes; $written += $rv) {
|
||||
$rv = fwrite($this->connection, substr($data, $written));
|
||||
if ($rv === false || $rv === 0) {
|
||||
return $written;
|
||||
}
|
||||
}
|
||||
return $written;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue