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

Wrong _realpath with 4 or more parent-directories #190

Closed
SpazzMarticus opened this issue Feb 23, 2016 · 2 comments
Closed

Wrong _realpath with 4 or more parent-directories #190

SpazzMarticus opened this issue Feb 23, 2016 · 2 comments

Comments

@SpazzMarticus
Copy link

Hi,

I got some wierd "Smarty: Unable to load template file" errors, and I followed them to the _realpath function in the Smarty class.

I tested the function by mocking getcwd to always return /0/1/2/3/4/5/6/7/8/9, set the DS constant to / and then tested _realpath with $realpath always being set to true.

Path: folder
Realpath: /0/1/2/3/4/5/6/7/8/9/folder

Path: ../folder
Realpath: /0/1/2/3/4/5/6/7/8/folder

Path: ../../folder
Realpath: /0/1/2/3/4/5/6/7/folder

Path: ../../../folder
Realpath: /0/1/2/3/4/5/6/folder


Wierd stuff occurs from here on:

Path: ../../../../folder
Realpath: /0/1/2/3/4/5/6/7/folder
Should be: /0/1/2/3/4/5/folder

Path: ../../../../../folder
Realpath: /0/1/2/3/4/5/6/folder
Should be: /0/1/2/3/4/folder

Path: ../../../../../../folder
Realpath: /0/1/2/3/4/5/folder
Should be: /0/1/2/3/folder

Path: ../../../../../../../folder
Realpath: /0/1/2/3/4/5/6/folder
Should be: /0/1/2/folder

Path: ../../../../../../../../folder
Realpath: /0/1/2/3/4/5/folder
Should be: /0/1/folder

Path: ../../../../../../../../../folder
Realpath: /0/1/2/3/4/5/6/folder
Should be: /0/folder

Can this be fixed, or is there any workaround?

@uwetews
Copy link
Contributor

uwetews commented Feb 25, 2016

The fix is now in the master branch

@uwetews uwetews closed this as completed Feb 25, 2016
@SpazzMarticus
Copy link
Author

Thanks for the fix! 😃

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