- bugfix changed code when writing temporary compiled files to allow stream_wrapper

This commit is contained in:
uwe.tews@googlemail.com
2010-12-11 13:55:06 +00:00
parent cf50ede71a
commit b8b68d7edf
2 changed files with 10 additions and 3 deletions

View File

@@ -2,6 +2,7 @@
11/12/2010
- bugfix nested block tags in template inheritance child templates did not work correctly
- bugfix {$smarty.current_dir} in child template did not point to dir of child template
- bugfix changed code when writing temporary compiled files to allow stream_wrapper
06/12/2010
- bugfix getTemplateVars() should return 'null' instead dropping E_NOTICE on an unassigned variable

View File

@@ -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);