From e3c0fd68827fc3dc6082654ed9919b820dfbd74e Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Fri, 12 Jan 2018 15:01:45 +0100 Subject: [PATCH] Fix strpos if needle is not found Found while testing strict_typing for PHP 7+. If `$script` does not contain a `/` then it should extract a string of the length 0. Signed-off-by: Morris Jobke --- lib/private/legacy/app.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index 1b9fc28873e24..8114895416b60 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -671,7 +671,7 @@ public static function getSettingsNavigation() { public static function getCurrentApp() { $request = \OC::$server->getRequest(); $script = substr($request->getScriptName(), strlen(OC::$WEBROOT) + 1); - $topFolder = substr($script, 0, strpos($script, '/')); + $topFolder = substr($script, 0, strpos($script, '/') ?: 0); if (empty($topFolder)) { $path_info = $request->getPathInfo(); if ($path_info) {