modxcms-jp/evolution — comment on commit d36d3e03f0c0e12d1170dd2d507c6d310a11ced1
File:  line 0
By yama:

Hello, Mike

function x_file_put_contents($file_path, $data)
{
if ($fh = fopen($file_path, 'c')) // 'c' is important
{
flock($fh, LOCK_EX);
ftruncate($fh, 0);
$rt = fwrite($fh, $data);
fclose($fh);
}
else $rt = false;
return $rt;
}

But... I think, Processing of writing is not considered but considers it more certain to check file size when reading conversely.