-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[Bug]: Files/Cache/Cache.php->get()
returns partial array, leads to errors
#33023
Closed
4 of 8 tasks
Labels
0. Needs triage
Pending check for reproducibility or if it fits our roadmap
bug
feature: encryption (server-side)
feature: filesystem
Comments
mejo-
added
bug
feature: encryption (server-side)
feature: filesystem
0. Needs triage
Pending check for reproducibility or if it fits our roadmap
labels
Jun 26, 2022
Hi, reminds me at: #22598 |
@kesselb, @icewind1991, @PVince81: what do you think about my proposed patch? Shall I open a PR? |
The proposed change looks good. In the long term, the whole "partial cache entry" is a wart that should probably be removed (and I don't remember the original motivation for it) |
mejo-
added a commit
that referenced
this issue
Jun 28, 2022
In some scenarios (file not in cache, but partial data of it in the object), Cache->get() might return an array, which leads to errors like "Call to a member function getId() on array". So check whether the returned entry is of type ICacheEntry before doing operations on it in Cache->remove(). Fixes: #33023 Signed-off-by: Jonas <jonas@freesources.org>
nextcloud-command
pushed a commit
that referenced
this issue
Jun 29, 2022
In some scenarios (file not in cache, but partial data of it in the object), Cache->get() might return an array, which leads to errors like "Call to a member function getId() on array". So check whether the returned entry is of type ICacheEntry before doing operations on it in Cache->remove(). Fixes: #33023 Signed-off-by: Jonas <jonas@freesources.org>
backportbot-nextcloud bot
pushed a commit
that referenced
this issue
Jun 29, 2022
In some scenarios (file not in cache, but partial data of it in the object), Cache->get() might return an array, which leads to errors like "Call to a member function getId() on array". So check whether the returned entry is of type ICacheEntry before doing operations on it in Cache->remove(). Fixes: #33023 Signed-off-by: Jonas <jonas@freesources.org>
backportbot-nextcloud bot
pushed a commit
that referenced
this issue
Jun 29, 2022
In some scenarios (file not in cache, but partial data of it in the object), Cache->get() might return an array, which leads to errors like "Call to a member function getId() on array". So check whether the returned entry is of type ICacheEntry before doing operations on it in Cache->remove(). Fixes: #33023 Signed-off-by: Jonas <jonas@freesources.org>
backportbot-nextcloud bot
pushed a commit
that referenced
this issue
Jun 29, 2022
In some scenarios (file not in cache, but partial data of it in the object), Cache->get() might return an array, which leads to errors like "Call to a member function getId() on array". So check whether the returned entry is of type ICacheEntry before doing operations on it in Cache->remove(). Fixes: #33023 Signed-off-by: Jonas <jonas@freesources.org>
nextcloud-command
pushed a commit
that referenced
this issue
Jun 30, 2022
In some scenarios (file not in cache, but partial data of it in the object), Cache->get() might return an array, which leads to errors like "Call to a member function getId() on array". So check whether the returned entry is of type ICacheEntry before doing operations on it in Cache->remove(). Fixes: #33023 Signed-off-by: Jonas <jonas@freesources.org>
nextcloud-command
pushed a commit
that referenced
this issue
Jun 30, 2022
In some scenarios (file not in cache, but partial data of it in the object), Cache->get() might return an array, which leads to errors like "Call to a member function getId() on array". So check whether the returned entry is of type ICacheEntry before doing operations on it in Cache->remove(). Fixes: #33023 Signed-off-by: Jonas <jonas@freesources.org>
nextcloud-command
pushed a commit
that referenced
this issue
Jun 30, 2022
In some scenarios (file not in cache, but partial data of it in the object), Cache->get() might return an array, which leads to errors like "Call to a member function getId() on array". So check whether the returned entry is of type ICacheEntry before doing operations on it in Cache->remove(). Fixes: #33023 Signed-off-by: Jonas <jonas@freesources.org>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
0. Needs triage
Pending check for reproducibility or if it fits our roadmap
bug
feature: encryption (server-side)
feature: filesystem
Bug description
Files/Cache/Cache.php->get()
returns an array (from$partial
) when it doesn't find the file in filecache.This leads to errors as other functions expect
get()
to return eitherICacheEntry
orfalse
. E.g.remove()
expects to get anICacheEntry
and callsgetId()
on the result.The bug seems to happen e.g. when deleting files from a Collectives app mountpoint with the Encryption app enabled. The Collectives app implements its own mountpoints, but no custom trash. So deleting a file moves it from the (unencrypted) Collectives storage to the default Nextcloud trash.
Steps to reproduce
Expected behavior
First, either
Cache->get()
should not return an array, or it should mention this in the type hints in PHP annotations.Second,
Cache->remove()
should probably check whether the returned$entry
is of typeICacheEntry
.The following patch solves the concrete problem with deleting pages in Collectives and enabled Encryption app, but I'm unsure whether it's the correct fix:
Installation method
No response
Operating system
No response
PHP engine version
No response
Web server
No response
Database engine version
No response
Is this bug present after an update or on a fresh install?
No response
Are you using the Nextcloud Server Encryption module?
No response
What user-backends are you using?
Configuration report
No response
List of activated Apps
Nextcloud Signing status
No response
Nextcloud Logs
No response
Additional info
No response
The text was updated successfully, but these errors were encountered: