mvc: FileObject write() should sync by default

This commit is contained in:
Franco Fichtner 2024-08-20 11:08:38 +02:00
parent 44a38462fb
commit d8b58d6417

View File

@ -118,11 +118,15 @@ class FileObject
* write contents to this file
* @param string $data start position
* @param int $length length to write
* @param bool $sync flush data
* @return this
*/
public function write(string $data, ?int $length = null)
public function write(string $data, ?int $length = null, bool $sync = true)
{
fwrite($this->fhandle, $data, $length);
if ($sync) {
fflush($this->fhandle);
}
return $this;
}