⚠️ This issue respects the following points: ⚠️
Bug description
I upgraded from Nextcloud 30 to 31 using occ and updater.phar method.
I cannot access the /settings/admin/overview and /settings/users pages anymore: both generate systematic server errors (see below). The culprit seems to be the type returned by the countUsers function in /lib/private/User/Database.php on line 475:
return $result->fetchOne();
Changing this line to
return ($result->fetchOne() !== false) ? (int) $result->fetchOne() : false;
allowed me to retreive access to these pages (this is why the integrity check fails below)
Others are affected, see https://help.nextcloud.com/t/fresh-install-of-server-31-oc-user-database-countusers-error/218958/4
Both 31.0.0 and 31.0.1 are affected.
Steps to reproduce
1.Upgrade from Nextcloud 30 to 31
2.Log in as admin
3.Try accessing /settings/admin/overview and /settings/users
Expected behavior
These pages should not generate server errors
Nextcloud Server version
31
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Apache (supported)
Database engine version
MySQL
Is this bug present after an update or on a fresh install?
Upgraded to a MAJOR version (ex. 31 to 32)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
{
"system": {
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"***REMOVED SENSITIVE VALUE***"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"dbtype": "mysql",
"version": "31.0.1.2",
"overwrite.cli.url": "***REMOVED SENSITIVE VALUE***o",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"debug": false,
"maintenance": false,
"maintenance_window_start": 1,
"enable_certificate_management": false,
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_smtpmode": "smtp",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"theme": "",
"trashbin_retention_obligation": "30, 31",
"loglevel": 0,
"updater.release.channel": "stable",
"versions_retention_obligation": "auto",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "465",
"mail_smtpauth": 1,
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"mail_smtpsecure": "ssl",
"overwriteprotocol": "https",
"mysql.utf8mb4": true,
"default_phone_region": "CH",
"app_install_overwrite": [
"spreed"
]
}
}
List of activated Apps
- activity: 4.0.0
- app_api: 5.0.2
- bruteforcesettings: 4.0.0
- circles: 31.0.0
- cloud_federation_api: 1.14.0
- comments: 1.21.0
- contactsinteraction: 1.12.0
- dav: 1.33.0
- federatedfilesharing: 1.21.0
- federation: 1.21.0
- files: 2.3.1
- files_downloadlimit: 4.0.0
- files_external: 1.23.0
- files_pdfviewer: 4.0.0
- files_reminders: 1.4.0
- files_sharing: 1.23.1
- files_trashbin: 1.21.0
- files_versions: 1.24.0
- logreader: 4.0.0
- lookup_server_connector: 1.19.0
- mail: 4.2.6
- nextcloud_announcements: 3.0.0
- notifications: 4.0.0
- oauth2: 1.19.1
- password_policy: 3.0.0
- photos: 4.0.0-dev.1
- privacy: 3.0.0
- profile: 1.0.0
- provisioning_api: 1.21.0
- recommendations: 4.0.0
- related_resources: 2.0.0
- serverinfo: 3.0.0
- settings: 1.14.0
- sharebymail: 1.21.0
- spreed: 21.0.1
- support: 3.0.0
- survey_client: 3.0.0
- systemtags: 1.21.1
- text: 5.0.0
- theming: 2.6.1
- twofactor_backupcodes: 1.20.0
- twofactor_totp: 13.0.0-dev.0
- updatenotification: 1.21.0
- user_status: 1.11.0
- viewer: 4.0.0
- weather_status: 1.11.0
- webhook_listeners: 1.2.0
- workflowengine: 2.13.0
Disabled:
- admin_audit: 1.21.0
- dashboard: 7.11.0 (installed 6.0.0)
- encryption: 2.19.0
- firstrunwizard: 4.0.0 (installed 2.4.0)
- suspicious_login: 9.0.1 (installed 1.0.0)
- twofactor_nextcloud_notification: 5.0.0
- user_ldap: 1.22.0
Nextcloud Signing status
Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.
Results
=======
- core
- INVALID_HASH
- lib/private/User/Database.php
Raw output
==========
Array
(
[core] => Array
(
[INVALID_HASH] => Array
(
[lib/private/User/Database.php] => Array
(
[expected] => abbafb9122557ac838c53e3d6efd871d4f95cebb14284232e2aa2b41b25c72dd72053ec1ef1683839e1ffa3620921759f6af4af5ee5170ad8dbd42bfdc7e9b8e
[current] => dd3cb7f808973a9acdc96c2d93beebb5ff6dbc973f34a619f9fadea0bba0990049432c5f6b822a75d67461b38ce01fa8d19d273900157fe893bcbe23626e6d33
)
)
)
)
Nextcloud Logs
{
"reqId": "Z9QAHECZeDCfmi2dzm_-kQABjhk",
"level": 3,
"time": "2025-03-14T10:08:39+00:00",
"remoteAddr": "185.22.110.40",
"user": "MYADMINUSER",
"app": "index",
"method": "GET",
"url": "/index.php/settings/admin/overview",
"message": "OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Database.php' line 475",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
"version": "31.0.1.2",
"exception": {
"Exception": "Exception",
"Message": "OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Database.php' line 475",
"Code": 0,
"Trace": [
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/AppFramework/App.php",
"line": 161,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/Route/Router.php",
"line": 307,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/base.php",
"line": 1022,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/index.php",
"line": 24,
"function": "handleRequest",
"class": "OC",
"type": "::"
}
],
"File": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/AppFramework/Http/Dispatcher.php",
"Line": 146,
"Previous": {
"Exception": "TypeError",
"Message": "OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned",
"Code": 0,
"Trace": [
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Manager.php",
"line": 500,
"function": "countUsers",
"class": "OC\\User\\Database",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/apps/updatenotification/lib/Settings/Admin.php",
"line": 142,
"function": "countUsersTotal",
"class": "OC\\User\\Manager",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/apps/updatenotification/lib/Settings/Admin.php",
"line": 79,
"function": "isWebUpdaterRecommended",
"class": "OCA\\UpdateNotification\\Settings\\Admin",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/apps/settings/lib/Controller/CommonSettingsTrait.php",
"line": 128,
"function": "getForm",
"class": "OCA\\UpdateNotification\\Settings\\Admin",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/apps/settings/lib/Controller/CommonSettingsTrait.php",
"line": 170,
"function": "formatSettings",
"class": "OCA\\Settings\\Controller\\AdminSettingsController",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/apps/settings/lib/Controller/AdminSettingsController.php",
"line": 55,
"function": "getIndexResponse",
"class": "OCA\\Settings\\Controller\\AdminSettingsController",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/AppFramework/Http/Dispatcher.php",
"line": 200,
"function": "index",
"class": "OCA\\Settings\\Controller\\AdminSettingsController",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/AppFramework/Http/Dispatcher.php",
"line": 114,
"function": "executeController",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/AppFramework/App.php",
"line": 161,
"function": "dispatch",
"class": "OC\\AppFramework\\Http\\Dispatcher",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/Route/Router.php",
"line": 307,
"function": "main",
"class": "OC\\AppFramework\\App",
"type": "::"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/base.php",
"line": 1022,
"function": "match",
"class": "OC\\Route\\Router",
"type": "->"
},
{
"file": "/home/secondes/public_html/MYDOMAIN.TLD/index.php",
"line": 24,
"function": "handleRequest",
"class": "OC",
"type": "::"
}
],
"File": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Database.php",
"Line": 475
},
"message": "OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Database.php' line 475",
"exception": [],
"CustomMessage": "OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Database.php' line 475"
},
"id": "67d4057f20a4e"
}
Additional info
Thanks for your help and for your understanding, this is my first bug report!
Bug description
I upgraded from Nextcloud 30 to 31 using occ and updater.phar method.
I cannot access the /settings/admin/overview and /settings/users pages anymore: both generate systematic server errors (see below). The culprit seems to be the type returned by the countUsers function in /lib/private/User/Database.php on line 475:
return $result->fetchOne();Changing this line to
return ($result->fetchOne() !== false) ? (int) $result->fetchOne() : false;allowed me to retreive access to these pages (this is why the integrity check fails below)
Others are affected, see https://help.nextcloud.com/t/fresh-install-of-server-31-oc-user-database-countusers-error/218958/4
Both 31.0.0 and 31.0.1 are affected.
Steps to reproduce
1.Upgrade from Nextcloud 30 to 31
2.Log in as admin
3.Try accessing /settings/admin/overview and /settings/users
Expected behavior
These pages should not generate server errors
Nextcloud Server version
31
Operating system
Debian/Ubuntu
PHP engine version
PHP 8.2
Web server
Apache (supported)
Database engine version
MySQL
Is this bug present after an update or on a fresh install?
Upgraded to a MAJOR version (ex. 31 to 32)
Are you using the Nextcloud Server Encryption module?
Encryption is Disabled
What user-backends are you using?
Configuration report
{ "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "***REMOVED SENSITIVE VALUE***" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "mysql", "version": "31.0.1.2", "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***o", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "debug": false, "maintenance": false, "maintenance_window_start": 1, "enable_certificate_management": false, "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_smtpmode": "smtp", "mail_domain": "***REMOVED SENSITIVE VALUE***", "theme": "", "trashbin_retention_obligation": "30, 31", "loglevel": 0, "updater.release.channel": "stable", "versions_retention_obligation": "auto", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "465", "mail_smtpauth": 1, "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***", "mail_smtpsecure": "ssl", "overwriteprotocol": "https", "mysql.utf8mb4": true, "default_phone_region": "CH", "app_install_overwrite": [ "spreed" ] } }List of activated Apps
Nextcloud Signing status
Nextcloud Logs
{ "reqId": "Z9QAHECZeDCfmi2dzm_-kQABjhk", "level": 3, "time": "2025-03-14T10:08:39+00:00", "remoteAddr": "185.22.110.40", "user": "MYADMINUSER", "app": "index", "method": "GET", "url": "/index.php/settings/admin/overview", "message": "OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Database.php' line 475", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36", "version": "31.0.1.2", "exception": { "Exception": "Exception", "Message": "OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Database.php' line 475", "Code": 0, "Trace": [ { "file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/AppFramework/App.php", "line": 161, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/Route/Router.php", "line": 307, "function": "main", "class": "OC\\AppFramework\\App", "type": "::" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/base.php", "line": 1022, "function": "match", "class": "OC\\Route\\Router", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/index.php", "line": 24, "function": "handleRequest", "class": "OC", "type": "::" } ], "File": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/AppFramework/Http/Dispatcher.php", "Line": 146, "Previous": { "Exception": "TypeError", "Message": "OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned", "Code": 0, "Trace": [ { "file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Manager.php", "line": 500, "function": "countUsers", "class": "OC\\User\\Database", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/apps/updatenotification/lib/Settings/Admin.php", "line": 142, "function": "countUsersTotal", "class": "OC\\User\\Manager", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/apps/updatenotification/lib/Settings/Admin.php", "line": 79, "function": "isWebUpdaterRecommended", "class": "OCA\\UpdateNotification\\Settings\\Admin", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/apps/settings/lib/Controller/CommonSettingsTrait.php", "line": 128, "function": "getForm", "class": "OCA\\UpdateNotification\\Settings\\Admin", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/apps/settings/lib/Controller/CommonSettingsTrait.php", "line": 170, "function": "formatSettings", "class": "OCA\\Settings\\Controller\\AdminSettingsController", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/apps/settings/lib/Controller/AdminSettingsController.php", "line": 55, "function": "getIndexResponse", "class": "OCA\\Settings\\Controller\\AdminSettingsController", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/AppFramework/Http/Dispatcher.php", "line": 200, "function": "index", "class": "OCA\\Settings\\Controller\\AdminSettingsController", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/AppFramework/Http/Dispatcher.php", "line": 114, "function": "executeController", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/AppFramework/App.php", "line": 161, "function": "dispatch", "class": "OC\\AppFramework\\Http\\Dispatcher", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/Route/Router.php", "line": 307, "function": "main", "class": "OC\\AppFramework\\App", "type": "::" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/lib/base.php", "line": 1022, "function": "match", "class": "OC\\Route\\Router", "type": "->" }, { "file": "/home/secondes/public_html/MYDOMAIN.TLD/index.php", "line": 24, "function": "handleRequest", "class": "OC", "type": "::" } ], "File": "/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Database.php", "Line": 475 }, "message": "OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Database.php' line 475", "exception": [], "CustomMessage": "OC\\User\\Database::countUsers(): Return value must be of type int|false, string returned in file '/home/secondes/public_html/MYDOMAIN.TLD/lib/private/User/Database.php' line 475" }, "id": "67d4057f20a4e" }Additional info
Thanks for your help and for your understanding, this is my first bug report!