diff options
| author | Simon Wisselink <wisskid@users.noreply.github.com> | 2022-11-22 22:31:54 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-11-22 22:31:54 +0100 |
| commit | 773b3b4b7c27408affd86e8df26f06d64937b883 (patch) | |
| tree | 6bee55889577f01a6e14dc92ba6ea5e4a41957e1 /libs | |
| parent | 613c5d691c55124ce7119098cbcdf744fd3255ff (diff) | |
| download | smarty-773b3b4b7c27408affd86e8df26f06d64937b883.tar.gz smarty-773b3b4b7c27408affd86e8df26f06d64937b883.tar.bz2 smarty-773b3b4b7c27408affd86e8df26f06d64937b883.zip | |
Change file permissions for directories and respect umask for written files. (#828)
Fixes #548
Fixes #819
Diffstat (limited to 'libs')
| -rw-r--r-- | libs/sysplugins/smarty_internal_runtime_writefile.php | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/libs/sysplugins/smarty_internal_runtime_writefile.php b/libs/sysplugins/smarty_internal_runtime_writefile.php index 18c14945..492d5eb2 100644 --- a/libs/sysplugins/smarty_internal_runtime_writefile.php +++ b/libs/sysplugins/smarty_internal_runtime_writefile.php @@ -29,7 +29,6 @@ class Smarty_Internal_Runtime_WriteFile { $_error_reporting = error_reporting(); error_reporting($_error_reporting & ~E_NOTICE & ~E_WARNING); - $old_umask = umask(0); $_dirpath = dirname($_filepath); // if subdirs, create dir structure if ($_dirpath !== '.') { @@ -37,7 +36,7 @@ class Smarty_Internal_Runtime_WriteFile // loop if concurrency problem occurs // see https://bugs.php.net/bug.php?id=35326 while (!is_dir($_dirpath)) { - if (@mkdir($_dirpath, 0771, true)) { + if (@mkdir($_dirpath, 0777, true)) { break; } clearstatcache(); @@ -85,8 +84,7 @@ class Smarty_Internal_Runtime_WriteFile throw new SmartyException("unable to write file {$_filepath}"); } // set file permissions - chmod($_filepath, 0644); - umask($old_umask); + @chmod($_filepath, 0666 & ~umask()); error_reporting($_error_reporting); return true; } |
