diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php
index 15bd7be9143c965f1a8b930874cc535b3c9fa732..d92d30156cbedea7af6a20c1dbe907baa579c66d 100644
--- a/apps/files_sharing/lib/api.php
+++ b/apps/files_sharing/lib/api.php
@@ -132,7 +132,8 @@ class Api {
 		// if there are no shares than there are also no reshares
 		if (count($shares) > 0) {
 			$ids = array();
-			$path = reset($shares)['path'];
+			$firstShare = reset($shares);
+			$path = $firstShare['path'];
 			foreach ($shares as $share) {
 				$ids[] = $share['id'];
 			}