mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
- rewrite mkdir() bugfix to retry automatically see https://github.com/smarty-php/smarty/pull/377
https://github.com/smarty-php/smarty/pull/379
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
===== 3.1.32 - dev ===
|
||||
30.7.2017
|
||||
- rewrite mkdir() bugfix to retry automatically see https://github.com/smarty-php/smarty/pull/377
|
||||
https://github.com/smarty-php/smarty/pull/379
|
||||
|
||||
21.7.2017
|
||||
- security possible PHP code injection on custom resources at display() or fetch()
|
||||
calls if the resource does not sanitize the template name
|
||||
|
@@ -108,7 +108,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.32-dev-14';
|
||||
const SMARTY_VERSION = '3.1.32-dev-15';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
|
@@ -39,10 +39,21 @@ class Smarty_Internal_Runtime_WriteFile
|
||||
$_dirpath = dirname($_filepath);
|
||||
|
||||
// if subdirs, create dir structure
|
||||
if ($_dirpath !== '.' && !@mkdir($_dirpath, $_dir_perms, true) && !is_dir($_dirpath)) {
|
||||
if ($_dirpath !== '.') {
|
||||
$i=0;
|
||||
// loop if concurrency problem occurs
|
||||
// see https://bugs.php.net/bug.php?id=35326
|
||||
while (!is_dir($_dirpath)) {
|
||||
if (@mkdir($_dirpath, $_dir_perms, true)) {
|
||||
break;
|
||||
}
|
||||
if (++$i === 3) {
|
||||
error_reporting($_error_reporting);
|
||||
throw new SmartyException("unable to create directory {$_dirpath}");
|
||||
}
|
||||
sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
// write to tmp file, then move to overt file lock race condition
|
||||
$_tmp_file = $_dirpath . $smarty->ds . str_replace(array('.', ','), '_', uniqid('wrt', true));
|
||||
|
Reference in New Issue
Block a user