add support for windows path on evaluateRequestUrl() method (#452)

* add support for windows path on evaluateRequestUrl() method

* update CHANGELOG.md
This commit is contained in:
Bitm@rte 2018-08-06 23:47:52 +02:00 committed by Daniel Rudolf
parent ac36863fa7
commit 9005edaa25
2 changed files with 8 additions and 1 deletions

View file

@ -16,6 +16,13 @@ Pico Changelog
`PicoDeprecated`'s changelog. Please note that BC-breaking changes
are only possible with a new major version.
### Version 2.0.2
Released: -
```
* [Fixed] Support Windows paths (`\` instead of `/`) in `Pico::evaluateRequestUrl()`
```
### Version 2.0.1
Released: 2018-07-29

View file

@ -1076,7 +1076,7 @@ class Pico
// use REQUEST_URI (requires URL rewriting); e.g. /pico/sub/page
if (($this->requestUrl === null) && $this->isUrlRewritingEnabled()) {
$basePath = dirname($_SERVER['SCRIPT_NAME']);
$basePath = !in_array($basePath, array('.', '/'), true) ? $basePath . '/' : '/';
$basePath = !in_array($basePath, array('.', '/', '\\'), true) ? $basePath . '/' : '/';
$basePathLength = strlen($basePath);
$requestUri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';