public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
{
$_is_muted_directory = false;
// add the SMARTY_DIR to the list of muted directories
if (!isset(Smarty::$_muted_directories[SMARTY_DIR])) {
$smarty_dir = realpath(SMARTY_DIR);
if ($smarty_dir !== false) {
Smarty::$_muted_directories[SMARTY_DIR] = array('file' => $smarty_dir, 'length' => strlen($smarty_dir));
}
}
// walk the muted directories and test against $errfile
foreach (Smarty::$_muted_directories as $key => &$dir) {
if (!$dir) {
// resolve directory and length for speedy comparisons
$file = realpath($key);
if ($file === false) {
// this directory does not exist, remove and skip it
unset(Smarty::$_muted_directories[$key]);
continue;
}
$dir = array('file' => $file, 'length' => strlen($file));
}
if (!strncmp($errfile, $dir['file'], $dir['length'])) {
$_is_muted_directory = true;
break;
}
}
// pass to next error handler if this error did not occur inside SMARTY_DIR
// or the error was within smarty but masked to be ignored
if (!$_is_muted_directory || $errno && $errno & error_reporting()) {
if (Smarty::$_previous_error_handler) {
return call_user_func(Smarty::$_previous_error_handler, $errno, $errstr, $errfile, $errline, $errcontext);
} else {
return false;
}
}
}