Always return a string in OC_App::getCurrentApp and no boolean

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
This commit is contained in:
Morris Jobke 2018-02-17 15:37:32 +01:00
parent e4077672e1
commit 9fcf185c7d
No known key found for this signature in database
GPG Key ID: FE03C3A163FEDE68
1 changed files with 2 additions and 2 deletions

View File

@ -616,7 +616,7 @@ class OC_App {
*
* @return string
*/
public static function getCurrentApp() {
public static function getCurrentApp(): string {
$request = \OC::$server->getRequest();
$script = substr($request->getScriptName(), strlen(OC::$WEBROOT) + 1);
$topFolder = substr($script, 0, strpos($script, '/') ?: 0);
@ -628,7 +628,7 @@ class OC_App {
}
if ($topFolder == 'apps') {
$length = strlen($topFolder);
return substr($script, $length + 1, strpos($script, '/', $length + 1) - $length - 1);
return substr($script, $length + 1, strpos($script, '/', $length + 1) - $length - 1) ?: '';
} else {
return $topFolder;
}