-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix FileAccess::getByFileId(InStorage) #45140
Conversation
Signed-off-by: Robin Appelman <robin@icewind.nl>
/backport to stable29 |
@@ -56,7 +56,7 @@ private function getQuery(): CacheQueryBuilder { | |||
} | |||
|
|||
public function getByFileIdInStorage(int $fileId, int $storageId): ?CacheEntry { | |||
$items = $this->getByFileIdsInStorage([$fileId], $storageId); | |||
$items = array_values($this->getByFileIdsInStorage([$fileId], $storageId)); | |||
return $items[0] ?? null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return $items[0] ?? null; | |
return reset($items) ?: null; |
And then you do not need the array_values
call.
But no idea if it’s more performant.
It just sucks that array_value_first did not make it in 😿 https://wiki.php.net/rfc/array_key_first_last#vote
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performance seems to be quite the same, ~10% difference (faster array_values
) on my system.
No description provided.