From b3d857c31b2cadb6ca3fd8c7ddfb27ddaebe4865 Mon Sep 17 00:00:00 2001 From: Franck Allimant Date: Thu, 17 Apr 2014 00:17:37 +0200 Subject: [PATCH] Fixes PHP Warning: strpos(): Empty needle --- core/lib/Thelia/Tools/URL.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/lib/Thelia/Tools/URL.php b/core/lib/Thelia/Tools/URL.php index c766d20e0..277ccd16c 100644 --- a/core/lib/Thelia/Tools/URL.php +++ b/core/lib/Thelia/Tools/URL.php @@ -141,7 +141,9 @@ class URL // As base URL also contains /thelia2 (e.g. http://some.server.com/thelia2), we end up with // http://some.server.com/thelia2/thelia2/my/path, instead of http://some.server.com/thelia2/my/path // We have to compensate for this. - $hasSubdirectory = 0 === strpos($path, $this->requestContext->getBaseUrl()); + $rcbu = $this->requestContext->getBaseUrl(); + + $hasSubdirectory = ! empty($rcbu) && (0 === strpos($path, $rcbu)); $base_url = $this->getBaseUrl($hasSubdirectory);