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

Improvement of BaseUrl-Handling including Windows-Support #2

Closed
glady opened this issue Jul 29, 2016 · 2 comments
Closed

Improvement of BaseUrl-Handling including Windows-Support #2

glady opened this issue Jul 29, 2016 · 2 comments
Labels

Comments

@glady
Copy link

glady commented Jul 29, 2016

When I have a server running on Windows, there are some problems with determinating the baseUrl, when no base-path is requested.

Example 1:

  • document root = X:\someRootPath
  • url = http://localhost/base/path/index.php
  • $_SERVER['SCRIPT_NAME'] = '/base/path/index.php'
  • Jentin-baseUrl = '/base/path/'
  • expected baseUrl = '/base/path' (no trailing /)

Example 2:

  • document root = X:\someRootPath\base\path
  • url = http://localhost/index.php
  • $_SERVER['SCRIPT_NAME'] = '/index.php'
  • Jentin-baseUrl = '/' (Bug: dirname on Windows returns \ when path is empty; then trailing /)
  • expected baseUrl = ''
@glady
Copy link
Author

glady commented Jul 29, 2016

Commit https://github.com/glady/Jentin/commit/ed900cc60ded9c38a222433e4ae21533e3156c99 adds a test case to base-url UnitTest that proves, that there is a problem with routing without baseUrl ('http://localhost/module/controller/action' says baseUrl is '/module/controller/', not '/' like expected by old behavior with trailing / or '' without it)

@glady
Copy link
Author

glady commented Jul 29, 2016

Tested with a local apache instance:

Request with var_dump of $_SERVER on url http://localhost:8080/module/controller/action
$_SERVER contains
'DOCUMENT_ROOT' => string 'C:/path/to/script'
'SCRIPT_FILENAME' => string 'C:/path/to/script/server.php'
'REQUEST_URI' => string '/module/controller/action'
'SCRIPT_NAME' => string '/server.php'
server.php should now apply Jentin routes defined, but it does define '/module/controller/' as basePath, which is not intended.

Conclusion: FileSystem paths CAN be completely different from uri, because uri can contain routing logic.

sigma-z added a commit that referenced this issue Jul 29, 2016
@sigma-z sigma-z closed this as completed Jul 29, 2016
sigma-z added a commit that referenced this issue Jul 31, 2016
@sigma-z sigma-z added the Bug label Jul 31, 2016
sigma-z added a commit that referenced this issue Aug 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants