Fixing Issue #118 - muteExpectedErrors would fail non-readable directories

This commit is contained in:
rodneyrehm
2012-11-01 10:10:10 +00:00
parent 3204262e0f
commit 642e021f45
2 changed files with 14 additions and 4 deletions

View File

@@ -1,4 +1,7 @@
===== trunk ===== ===== trunk =====
01.11.2012
- bugfix muteExcpetedErrors() would screw up for non-readable paths (Issue #118)
===== Smarty-3.1.12 ===== ===== Smarty-3.1.12 =====
14.09.2012 14.09.2012
- bugfix template inheritance failed to compile with delimiters {/ and /} (Forum Topic 23008) - bugfix template inheritance failed to compile with delimiters {/ and /} (Forum Topic 23008)

View File

@@ -1392,10 +1392,12 @@ class Smarty extends Smarty_Internal_TemplateBase {
// add the SMARTY_DIR to the list of muted directories // add the SMARTY_DIR to the list of muted directories
if (!isset(Smarty::$_muted_directories[SMARTY_DIR])) { if (!isset(Smarty::$_muted_directories[SMARTY_DIR])) {
$smarty_dir = realpath(SMARTY_DIR); $smarty_dir = realpath(SMARTY_DIR);
Smarty::$_muted_directories[SMARTY_DIR] = array( if ($smarty_dir !== false) {
'file' => $smarty_dir, Smarty::$_muted_directories[SMARTY_DIR] = array(
'length' => strlen($smarty_dir), 'file' => $smarty_dir,
); 'length' => strlen($smarty_dir),
);
}
} }
// walk the muted directories and test against $errfile // walk the muted directories and test against $errfile
@@ -1403,6 +1405,11 @@ class Smarty extends Smarty_Internal_TemplateBase {
if (!$dir) { if (!$dir) {
// resolve directory and length for speedy comparisons // resolve directory and length for speedy comparisons
$file = realpath($key); $file = realpath($key);
if ($file === false) {
// this directory does not exist, remove and skip it
unset(Smarty::$_muted_directories[$key]);
continue;
}
$dir = array( $dir = array(
'file' => $file, 'file' => $file,
'length' => strlen($file), 'length' => strlen($file),