mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-21 00:15:20 +02:00
improved include_path resolving
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user