mirror of
https://github.com/smarty-php/smarty.git
synced 2025-12-05 00:39:23 +01:00
- bugfix changed code when writing temporary compiled files to allow stream_wrapper
This commit is contained in:
@@ -30,11 +30,17 @@ class Smarty_Internal_Write_File {
|
||||
// write to tmp file, then move to overt file lock race condition
|
||||
$_tmp_file = tempnam($_dirpath, 'wrt');
|
||||
|
||||
if (!file_put_contents($_tmp_file, $_contents)) {
|
||||
umask($old_umask);
|
||||
if (!($fd = @fopen($_tmp_file, 'wb'))) {
|
||||
$_tmp_file = $_dirname . DS . uniqid('wrt');
|
||||
if (!($fd = @fopen($_tmp_file, 'wb'))) {
|
||||
throw new SmartyException("unable to write file {$_tmp_file}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fwrite($fd, $_contents);
|
||||
fclose($fd);
|
||||
|
||||
// remove original file
|
||||
if (file_exists($_filepath))
|
||||
@unlink($_filepath);
|
||||
|
||||
Reference in New Issue
Block a user