improved include_path resolving

This commit is contained in:
rodneyrehm
2012-02-06 20:45:10 +00:00
parent 0f39bdfd59
commit e91ee4c5ec
3 changed files with 41 additions and 5 deletions

View File

@@ -254,6 +254,8 @@ abstract class Smarty_Resource {
}
}
}
$_stream_resolve_include_path = function_exists('stream_resolve_include_path');
// relative file name?
if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $file)) {
@@ -264,7 +266,13 @@ abstract class Smarty_Resource {
}
if ($source->smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_directory)) {
// try PHP include_path
if (($_filepath = Smarty_Internal_Get_Include_Path::getIncludePath($_filepath)) !== false) {
if ($_stream_resolve_include_path) {
$_filepath = stream_resolve_include_path($_filepath);
} else {
$_filepath = Smarty_Internal_Get_Include_Path::getIncludePath($_filepath);
}
if ($_filepath !== false) {
if ($this->fileExists($source, $_filepath)) {
return $_filepath;
}