Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysplugins/smarty_internal_resource_file.php : buildFilepath() relative path bug #50

Closed
asamaru7 opened this issue Jun 9, 2015 · 3 comments

Comments

@asamaru7
Copy link

asamaru7 commented Jun 9, 2015

case : $_template->parent->source->filepath is "/a/b/c/../../d/e/abc.tpl"


$path = dirname($_template->parent->source->filepath);
...
$path = str_replace(array('', './'), array('/', ''), $path);


$path
result : "/a/b/c/..d/e/" <= wrong value
expect : "/a/b/c/../../d/e/"

modify


$path = dirname($_template->parent->source->filepath);
=>
$path = realpath(dirname($_template->parent->source->filepath));


$path
result : "/a/d/e/" <= right value

@uwetews
Copy link
Contributor

uwetews commented Jun 9, 2015

Which Smarty version do you run?
How dies the template_dir path look like What is the file path specified at display()/ {include}

@asamaru7
Copy link
Author

smarty version : 3.1.24
php version : 5.5
template_dir : DIR . '/../../../a/b/'

{{include file="a.tpl"}} <= OK


{{include file="./a.tpl"}} <= Error

Unable to load template file './a.tpl' in 'index.tpl'

uwetews added a commit that referenced this issue Jun 14, 2015
… did contain /../ #50

  - optimization rework of path normalization
@uwetews
Copy link
Contributor

uwetews commented Jun 14, 2015

The fix is now in dev-master

Path normalization has been completely reworked

@uwetews uwetews closed this as completed Jun 14, 2015
think-mcunanan pushed a commit to think-mcunanan/smarty that referenced this issue Mar 22, 2023
Merge release-2.0.6 release branch into master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants