note 120709 added to function.file-put-contents
| From: | Anonymous | Date: | Sun, 26 Feb 2017 10:20:14 +0000 |
| Subject: | note 120709 added to function.file-put-contents | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-208857@lists.php.net to get a copy of this message | ||
Make sure not to corrupt anything in case of failure.
<?php
function file_put_contents_atomically($filename, $data, $flags = 0, $context = null) {
if (file_put_contents($filename."~", $data, $flags, $context) === strlen($contents)) {
return rename($filename."~",$filename,$context);
}
@unlink($filename."~", $context);
return FALSE;
}
?>
----
Server IP: 72.52.91.14
Probable Submitter: 5.23.98.82
----
Manual Page -- http://php.net/manual/en/function.file-put-contents.php
Edit -- https://master.php.net/note/edit/120709
Del: integrated -- https://master.php.net/note/delete/120709/integrated
Del: useless -- https://master.php.net/note/delete/120709/useless
Del: bad code -- https://master.php.net/note/delete/120709/bad+code
Del: spam -- https://master.php.net/note/delete/120709/spam
Del: non-english -- https://master.php.net/note/delete/120709/non-english
Del: in docs -- https://master.php.net/note/delete/120709/in+docs
Del: other reasons-- https://master.php.net/note/delete/120709
Reject -- https://master.php.net/note/reject/120709
Search -- https://master.php.net/manage/user-notes.php