From 9ff51aafc518460e6c45996f09e9fe74e5f8d2e8 Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 25 Jan 2018 22:26:47 +0100 Subject: Use index based string access for substr with length of 1 Signed-off-by: Morris Jobke --- lib/private/Files/View.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/private/Files/View.php') diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index fb0b116666e..1553444e05d 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -698,7 +698,7 @@ class View { // do not allow deleting the root return false; } - $postFix = (substr($path, -1, 1) === '/') ? '/' : ''; + $postFix = (substr($path, -1) === '/') ? '/' : ''; $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); if ($mount and $mount->getInternalPath($absolutePath) === '') { @@ -1067,7 +1067,7 @@ class View { * @return bool|null|string */ public function hash($type, $path, $raw = false) { - $postFix = (substr($path, -1, 1) === '/') ? '/' : ''; + $postFix = (substr($path, -1) === '/') ? '/' : ''; $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); if (Filesystem::isValidPath($path)) { $path = $this->getRelativePath($absolutePath); @@ -1119,7 +1119,7 @@ class View { * \OC\Files\Storage\Storage for delegation to a storage backend for execution */ private function basicOperation($operation, $path, $hooks = [], $extraParam = null) { - $postFix = (substr($path, -1, 1) === '/') ? '/' : ''; + $postFix = (substr($path, -1) === '/') ? '/' : ''; $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); if (Filesystem::isValidPath($path) and !Filesystem::isFileBlacklisted($path) -- cgit v1.2.3