From f0ac8a278ac8a6e07f7f4efb5455c4fb87996953 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 13 Jan 2015 11:03:58 +0100 Subject: [PATCH] Use json_encode on string It's better to encode the string to prevent possible (yet unknown) bugs in combination with PHP's type juggling. Previously the boolean statements evaluated to either an empty string (false) or a not empty one (true, then it was 1). Not it always evaluates to false or true. This also removes a stray - that was not intended there but shouldn't have produced any bugs. Just to increase readability. Thanks @nickvergessen for spotting. Addresses https://github.com/owncloud/core/pull/13235/files#r22852319 --- lib/private/files/filesystem.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php index 100b364ca0..f90b2738d0 100644 --- a/lib/private/files/filesystem.php +++ b/lib/private/files/filesystem.php @@ -715,7 +715,7 @@ class Filesystem { * @return string */ public static function normalizePath($path, $stripTrailingSlash = true, $isAbsolutePath = false) { - $cacheKey = $path.'-'.-$stripTrailingSlash.'-'.$isAbsolutePath; + $cacheKey = json_encode([$path, $stripTrailingSlash, $isAbsolutePath]); if(isset(self::$normalizedPathCache[$cacheKey])) { return self::$normalizedPathCache[$cacheKey];