diff options
| author | rodneyrehm <rodneyrehm@localhost> | 2011-09-20 14:12:34 +0000 |
|---|---|---|
| committer | rodneyrehm <rodneyrehm@localhost> | 2011-09-20 14:12:34 +0000 |
| commit | 2df84e24a6864a757a5b36dcba74c43276505e79 (patch) | |
| tree | ead9536ef8b2834b18800d7375790ff8f86dd9df | |
| parent | 29a7600b747c29187ac29f8695ac84504c09137f (diff) | |
| download | smarty-2df84e24a6864a757a5b36dcba74c43276505e79.tar.gz smarty-2df84e24a6864a757a5b36dcba74c43276505e79.tar.bz2 smarty-2df84e24a6864a757a5b36dcba74c43276505e79.zip | |
- bugfix relative paths in $template_dir broke relative path resolving in {include "../foo.tpl"}
| -rw-r--r-- | change_log.txt | 1 | ||||
| -rw-r--r-- | libs/sysplugins/smarty_resource.php | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/change_log.txt b/change_log.txt index fa60f14b..5a53f817 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,7 @@ ===== Smarty 3.1 trunk ===== 20.09.2011 - bugfix removed debug echo output while compiling template inheritance +- bugfix relative paths in $template_dir broke relative path resolving in {include "../foo.tpl"} 19.09.2011 - bugfix regression in Smarty_CacheReource_KeyValueStore introduced by r4261 diff --git a/libs/sysplugins/smarty_resource.php b/libs/sysplugins/smarty_resource.php index 852939e3..04fae95d 100644 --- a/libs/sysplugins/smarty_resource.php +++ b/libs/sysplugins/smarty_resource.php @@ -159,6 +159,11 @@ abstract class Smarty_Resource { } $file = dirname($_template->parent->source->filepath) . DS . $file; $_file_exact_match = true; + if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $file)) { + // the path gained from the parent template is relative to the current working directory + // as expansions (like include_path) have already been done + $file = getcwd() . DS . $file; + } } elseif ($_file_is_dotted) { throw new SmartyException("Template '{$file}' may not start with ../ or ./'"); } |
