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

Windows paths parsed wrong? #277

Closed
flexjoly opened this issue Aug 21, 2016 · 4 comments
Closed

Windows paths parsed wrong? #277

flexjoly opened this issue Aug 21, 2016 · 4 comments

Comments

@flexjoly
Copy link

flexjoly commented Aug 21, 2016

Hi,

Risking a stupid question, but i will give it a try....

I am trying to set the dirs for templates, compile etc. with smarty(3.1.30), php 7 (7.0.10), on xampp on windows10.

I have some dirs like:
D:\development\someproject\cache\templates_c
D:\development\core\templates

When setting these dirs and testing the smarty-install it says:

Testing template directory...
FAILED: D:\development\someproject\public/D:/development/core/templates/ does not exist.
Testing compile directory...
FAILED: D:\development\someproject\public/D:/development/someproject/cache/templates_c/ does not exist.

I found Smarty->_realpath() using getcwd() to find the current-directy. That explains why it give the /public. ($parts['root'] is empty)
It does not recognize the absolute windows-path it seems.

Am i doing something wrong? Or is this an issue in _realpath()?

(minor question: it is adviced to setup the dirs above the public-root (httdocs). So why is smarty trying to find the relative paths inside the public-root? )

I searched a lot, before asking. But could not find a similar question or answer so far.
I hope someone can help or fix this.

Greetz, flexjoly

@uwetews
Copy link
Contributor

uwetews commented Aug 22, 2016

Have you defined as constant DS = '/' ?
Smarty defines DS as shortcut for DIRECTORY_SEPARATOR.
But if it is defined to something else before it will fail like this.
So it was not a good idea to use the DS shortcut in _realpath()
I will change it do use DIRECTORY_SEPARATOR;

@flexjoly
Copy link
Author

Ah, yes i have ;)

@flexjoly
Copy link
Author

When using DIRECTORY_SEPARATOR in _realpath()
the problem is fixed indeed!! :-)

Have you seen my second question/remark? Why is smarty trying to find the dirs inside the public-root?

uwetews added a commit that referenced this issue Aug 23, 2016
@uwetews
Copy link
Contributor

uwetews commented Aug 23, 2016

The fix is now in the master branch.
I replaced DS by a Smarty property as I need to redefine it in the PHPunit tests.

The failure occurred as I did first normalized the separators to DS which in your case was not DIRECTORY_SEPARATOR. This caused that D:/ was not detected as root as it was not expected.

@uwetews uwetews closed this as completed Aug 23, 2016
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