mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-23 21:29:58 +09:00
Fix error when writing an empty file
This commit is contained in:
parent
da3e971486
commit
c71b90b2d6
1 changed files with 4 additions and 4 deletions
|
|
@ -256,17 +256,17 @@ class Storage
|
|||
flock($fp, \LOCK_EX);
|
||||
if (is_resource($content))
|
||||
{
|
||||
$result = stream_copy_to_stream($content, $fp) ? true : false;
|
||||
$result = stream_copy_to_stream($content, $fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
$result = fwrite($fp, $content) ? true : false;
|
||||
$result = fwrite($fp, $content);
|
||||
}
|
||||
fflush($fp);
|
||||
flock($fp, \LOCK_UN);
|
||||
fclose($fp);
|
||||
|
||||
if (!$result)
|
||||
if ($result === false)
|
||||
{
|
||||
trigger_error('Cannot write file: ' . (isset($original_filename) ? $original_filename : $filename), \E_USER_WARNING);
|
||||
return false;
|
||||
|
|
@ -303,7 +303,7 @@ class Storage
|
|||
}
|
||||
|
||||
clearstatcache(true, $filename);
|
||||
return $result;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue