From d266a5193501576acb3834a5b65e96ab184b7087 Mon Sep 17 00:00:00 2001 From: Ganesh Kandu Date: Fri, 25 Mar 2022 13:18:21 +0530 Subject: [PATCH] Wrong $httpRootDir MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > str_replace — Replace all occurrences of the search string with the replacement string My http root directory is ```/home/usr/public_html/``` public folder is ```/home/usr/public_html/public``` str_replace replacing ```/public``` from and making it like ```/home/usr_html``` which is wrong. ```php $httpRootDir = substr($publicDir,0,-strlen($basePath)); ``` This solution is working for me --- Engine/Asset.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/Asset.php b/Engine/Asset.php index e68097f4c..abd497939 100644 --- a/Engine/Asset.php +++ b/Engine/Asset.php @@ -87,7 +87,7 @@ public function resolve(string $path): string { $publicDir = str_replace('\\', '/', $this->kernel->getProjectDir()) . '/public'; $basePath = $this->router->getContext()->getBaseUrl(); - $httpRootDir = str_replace($basePath, '', $publicDir); + $httpRootDir = substr($publicDir,0,-strlen($basePath)); // return immediately for straight asset paths $path = s($path);