From 9b445ac5b6b79488d4bcd7c2bd16cc5ce83be40c Mon Sep 17 00:00:00 2001 From: Matias Griese Date: Tue, 7 Nov 2017 16:57:52 +0200 Subject: [PATCH] Fixed "Invalid AJAX response" When using Built-in PHP Webserver in Windows (#1258) --- CHANGELOG.md | 1 + system/src/Grav/Common/Uri.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d829fe12..9e97dcfb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * Reverted `case_insensitive_urls` option as it was causing issues with taxonomy [#1733](https://github.com/getgrav/grav/pull/1733) * Removed an extra `/` in `CompileFile.php` [#1693](https://github.com/getgrav/grav/pull/1693) * Uri: Encode user and password to prevent issues in browsers + * Fixed "Invalid AJAX response" When using Built-in PHP Webserver in Windows [#1258](https://github.com/getgrav/grav/issues/1258) # v1.3.8 ## 10/26/2017 diff --git a/system/src/Grav/Common/Uri.php b/system/src/Grav/Common/Uri.php index e87584885..473cf460e 100644 --- a/system/src/Grav/Common/Uri.php +++ b/system/src/Grav/Common/Uri.php @@ -249,7 +249,8 @@ class Uri */ private function buildRootPath() { - $scriptPath = $_SERVER['PHP_SELF']; + // In Windows script path uses backslash, convert it: + $scriptPath = str_replace('\\', '/', $_SERVER['PHP_SELF']); $rootPath = str_replace(' ', '%20', rtrim(substr($scriptPath, 0, strpos($scriptPath, 'index.php')), '/')); // check if userdir in the path and workaround PHP bug with PHP_SELF