- bugfix Smarty version was not filled in header comment of compiled and cached files

This commit is contained in:
Uwe Tews
2017-10-26 05:09:07 +02:00
parent 87f260e3a9
commit c404294a1f
2 changed files with 15 additions and 18 deletions

View File

@@ -1,4 +1,7 @@
===== 3.1.32 - dev === ===== 3.1.32 - dev ===
26.10.2017 3.1.32-dev-28
- bugfix Smarty version was not filled in header comment of compiled and cached files
21.10.2017 21.10.2017
- bugfix custom delimiters could fail since modification of version 3.1.32-dev-23 - bugfix custom delimiters could fail since modification of version 3.1.32-dev-23
https://github.com/smarty-php/smarty/issues/394 https://github.com/smarty-php/smarty/issues/394

View File

@@ -6,7 +6,6 @@
* @subpackage PluginsInternal * @subpackage PluginsInternal
* @author Monte Ohrt * @author Monte Ohrt
*/ */
/** /**
* Smarty Internal Write File Class * Smarty Internal Write File Class
* *
@@ -35,34 +34,30 @@ class Smarty_Internal_Runtime_WriteFile
if ($_file_perms !== null) { if ($_file_perms !== null) {
$old_umask = umask(0); $old_umask = umask(0);
} }
$_dirpath = dirname($_filepath); $_dirpath = dirname($_filepath);
// if subdirs, create dir structure
// if subdirs, create dir structure
if ($_dirpath !== '.') { if ($_dirpath !== '.') {
$i=0; $i = 0;
// loop if concurrency problem occurs // loop if concurrency problem occurs
// see https://bugs.php.net/bug.php?id=35326 // see https://bugs.php.net/bug.php?id=35326
while (!is_dir($_dirpath)) { while (!is_dir($_dirpath)) {
if (@mkdir($_dirpath, $_dir_perms, true)) { if (@mkdir($_dirpath, $_dir_perms, true)) {
break; break;
} }
clearstatcache(); clearstatcache();
if (++$i === 3) { if (++$i === 3) {
error_reporting($_error_reporting); error_reporting($_error_reporting);
throw new SmartyException("unable to create directory {$_dirpath}"); throw new SmartyException("unable to create directory {$_dirpath}");
} }
sleep(1); sleep(1);
} }
} }
// write to tmp file, then move to overt file lock race condition // write to tmp file, then move to overt file lock race condition
$_tmp_file = $_dirpath . $smarty->ds . str_replace(array('.', ','), '_', uniqid('wrt', true)); $_tmp_file = $_dirpath . DIRECTORY_SEPARATOR . str_replace(array('.', ','), '_', uniqid('wrt', true));
if (!file_put_contents($_tmp_file, $_contents)) { if (!file_put_contents($_tmp_file, $_contents)) {
error_reporting($_error_reporting); error_reporting($_error_reporting);
throw new SmartyException("unable to write file {$_tmp_file}"); throw new SmartyException("unable to write file {$_tmp_file}");
} }
/* /*
* Windows' rename() fails if the destination exists, * Windows' rename() fails if the destination exists,
* Linux' rename() properly handles the overwrite. * Linux' rename() properly handles the overwrite.
@@ -99,7 +94,6 @@ class Smarty_Internal_Runtime_WriteFile
umask($old_umask); umask($old_umask);
} }
error_reporting($_error_reporting); error_reporting($_error_reporting);
return true; return true;
} }
} }