From 7baf00d67ea14958f0a906900765d108ac745bae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rokas=20Mikalk=C4=97nas?= Date: Mon, 19 Jun 2017 21:53:54 +0300 Subject: [PATCH] Relative path finding fix If `$this->localProjectDir = '/app'` and `$absolutePath = '/app/web/app_dev.php'` then `$relativePath = '/web_dev.php'` and `validatePathIsRelativeToProject` throws `InvalidConfigurationException`. As I understand it should remove absolute paths dir --- src/Configuration/DefaultConfiguration.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Configuration/DefaultConfiguration.php b/src/Configuration/DefaultConfiguration.php index 8ba6273..31e3e7c 100644 --- a/src/Configuration/DefaultConfiguration.php +++ b/src/Configuration/DefaultConfiguration.php @@ -272,6 +272,10 @@ public function controllersToRemove(array $paths) : self $localRelativePaths = array_map(function ($absolutePath) { $relativePath = str_replace($this->localProjectDir, '', $absolutePath); + if (Str::startsWith($absolutePath, $this->localProjectDir)) { + $relativePath = mb_substr($absolutePath, mb_strlen($this->localProjectDir)); + } + $this->validatePathIsRelativeToProject($relativePath, 'controllersToRemove'); return trim($relativePath, DIRECTORY_SEPARATOR);