From 9005edaa25b25ec86afa39ef708feb86252f1552 Mon Sep 17 00:00:00 2001 From: "Bitm@rte" Date: Mon, 6 Aug 2018 23:47:52 +0200 Subject: [PATCH] add support for windows path on evaluateRequestUrl() method (#452) * add support for windows path on evaluateRequestUrl() method * update CHANGELOG.md --- CHANGELOG.md | 7 +++++++ lib/Pico.php | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9ffc788..8a88642 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/lib/Pico.php b/lib/Pico.php index bfa5be6..ce628d5 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -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'] : '';