Skip to content
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

Memory cache returns users as ARRAY, not as Object #168

Open
rotdrop opened this issue Feb 1, 2022 · 0 comments
Open

Memory cache returns users as ARRAY, not as Object #168

rotdrop opened this issue Feb 1, 2022 · 0 comments

Comments

@rotdrop
Copy link
Contributor

rotdrop commented Feb 1, 2022

Hi,

at least when using the REDIS cache as distributed cache the cached users are first encoded to JSON, and decoded from JSON to an array when read back. This results in error messages like:

  | Error: Attempt  to read property "uid" on array at  /var/www/orgacloud/nextcloud/apps/user_sql/lib/Backend/UserBackend.php#432  /var/www/orgacloud/nextcloud/lib/private/Log/ErrorHandler.php:95
-- | --

I have also added some diagnostic log messages in the UserBackend.php, and indeed

$this->logger->info('USER ' . print_r($user, true)); 
...
USER Array ( [uid] => 

A workaround is to disable the cache. However, this should be fixed. The affected function is getUser(). There around line
457
the cache value is just used as is, but it is an array created by json_decode(..., true) and not an object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant