serverinfo icon indicating copy to clipboard operation
serverinfo copied to clipboard

Error in log after upgrade to Nextcloud 23: foreach() argument must be of type array|object, bool given

Open TheColin21 opened this issue 4 years ago • 1 comments

Steps to reproduce

  1. Have a Nextcloud instance running Nextcloud 22
  2. Upgrade to 23
  3. look at the logs

Expected behaviour

no errors appearing

Actual behaviour

the error I pasted a few lines further down appears

Server configuration

Operating system: Ubuntu 20.04

Web server: Apache behind Nginx

Database: MariaDB

PHP version: 8.0

Nextcloud version: 23.0.0

Where did you install Nextcloud from: nextcloud.com

List of activated apps: Enabled:

  • accessibility: 1.9.0
  • activity: 2.15.0
  • admin_audit: 1.13.0
  • apporder: 0.13.0
  • audioplayer: 3.2.2
  • breezedark: 22.1.0
  • bruteforcesettings: 2.2.0
  • camerarawpreviews: 0.7.15
  • checksum: 1.1.2
  • cloud_federation_api: 1.6.0
  • comments: 1.13.0
  • contactsinteraction: 1.4.0
  • dashboard: 7.3.0
  • dav: 1.21.0
  • extract: 1.3.2
  • federatedfilesharing: 1.13.0
  • federation: 1.13.0
  • files: 1.18.0
  • files_antivirus: 3.2.2
  • files_downloadactivity: 1.11.1
  • files_external: 1.15.0
  • files_mindmap: 0.0.25
  • files_pdfviewer: 2.4.0
  • files_rightclick: 1.2.0
  • files_sharing: 1.15.0
  • files_texteditor: 2.14.0
  • files_trackdownloads: 1.11.0
  • files_trashbin: 1.13.0
  • files_versions: 1.16.0
  • files_videoplayer: 1.12.0
  • files_zip: 1.0.0
  • firstrunwizard: 2.12.0
  • imageconverter: 1.3.2
  • impersonate: 1.10.0
  • logreader: 2.8.0
  • lookup_server_connector: 1.11.0
  • mail: 1.11.0
  • maps: 0.1.9
  • metadata: 0.14.0
  • notifications: 2.11.1
  • oauth2: 1.11.0
  • onlyoffice: 7.2.0
  • password_policy: 1.13.0
  • photos: 1.5.0
  • previewgenerator: 3.3.0
  • privacy: 1.7.0
  • provisioning_api: 1.13.0
  • ransomware_protection: 1.11.0
  • recommendations: 1.2.0
  • serverinfo: 1.13.0
  • settings: 1.5.0
  • sharebymail: 1.13.0
  • spreed: 13.0.0
  • text: 3.4.0
  • theming: 1.14.0
  • twofactor_backupcodes: 1.12.0
  • twofactor_totp: 6.1.0
  • updatenotification: 1.13.0
  • user_status: 1.3.1
  • viewer: 1.7.0
  • weather_status: 1.3.0
  • workflowengine: 2.5.0 Disabled:
  • circles
  • encryption
  • nextcloud_announcements
  • passwords
  • support
  • survey_client
  • systemtags
  • user_ldap yes, there are a few unsupported apps. Those should absolutely not influence this error

Nextcloud configuration: { "system": { "instanceid": "REMOVED SENSITIVE VALUE", "passwordsalt": "REMOVED SENSITIVE VALUE", "secret": "REMOVED SENSITIVE VALUE", "trusted_domains": [ "clnp.cloud", "cloud.clnp.eu", "cloud.saef-zf.de", "cloud.ti19.de" ], "datadirectory": "REMOVED SENSITIVE VALUE", "dbtype": "mysql", "version": "23.0.0.10", "overwrite.cli.url": "https://clnp.cloud", "htaccess.RewriteBase": "/", "dbname": "REMOVED SENSITIVE VALUE", "dbhost": "REMOVED SENSITIVE VALUE", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "REMOVED SENSITIVE VALUE", "dbpassword": "REMOVED SENSITIVE VALUE", "installed": true, "mail_smtpmode": "sendmail", "mail_from_address": "REMOVED SENSITIVE VALUE", "mail_domain": "REMOVED SENSITIVE VALUE", "memcache.local": "\OC\Memcache\APCu", "memcache.distributed": "\OC\Memcache\Redis", "redis": { "host": "REMOVED SENSITIVE VALUE", "port": 0 }, "memcache.locking": "\OC\Memcache\Redis", "updater.release.channel": "stable", "loglevel": 0, "maintenance": false, "theme": "", "app_install_overwrite": [ "camerarawpreviews", "files_texteditor", "previewgenerator", "imageconverter", "apporder", "breezedark", "bruteforcesettings", "checksum", "files_downloadactivity", "files_trackdownloads", "files_mindmap", "metadata", "onlyoffice", "twofactor_totp" ], "ldapIgnoreNamingRules": false, "default_language": "de", "default_locale": "de", "default_phone_region": "DE", "defaultapp": "files", "trusted_proxies": "REMOVED SENSITIVE VALUE", "twofactor_enforced": "false", "twofactor_enforced_groups": [], "twofactor_enforced_excluded_groups": [] } }

Client configuration

Browser: Edge Chromium 96

Operating system: Windows 11

Logs

Nextcloud log (data/owncloud.log)

Error: foreach() argument must be of type array|object, bool given at /var/www/vhosts/domain.tld/httpdocs/apps/serverinfo/lib/OperatingSystems/DefaultOs.php#152
/var/www/vhosts/domain.tld/httpdocs/apps/serverinfo/lib/OperatingSystems/DefaultOs.php - line 152:

OC\Log\ErrorHandler::onError()

/var/www/vhosts/domain.tld/httpdocs/apps/serverinfo/lib/Os.php - line 141:

OCA\ServerInfo\OperatingSystems\DefaultOs->getNetworkInterfaces()

/var/www/vhosts/domain.tld/httpdocs/apps/serverinfo/lib/Settings/AdminSettings.php - line 114:

OCA\ServerInfo\Os->getNetworkInterfaces()

/var/www/vhosts/domain.tld/httpdocs/apps/settings/lib/Controller/CommonSettingsTrait.php - line 129:

OCA\ServerInfo\Settings\AdminSettings->getForm()

/var/www/vhosts/domain.tld/httpdocs/apps/settings/lib/Controller/AdminSettingsController.php - line 83:

OCA\Settings\Controller\AdminSettingsController->formatSettings()

/var/www/vhosts/domain.tld/httpdocs/apps/settings/lib/Controller/CommonSettingsTrait.php - line 140:

OCA\Settings\Controller\AdminSettingsController->getSettings()

/var/www/vhosts/domain.tld/httpdocs/apps/settings/lib/Controller/AdminSettingsController.php - line 68:

OCA\Settings\Controller\AdminSettingsController->getIndexResponse()

/var/www/vhosts/domain.tld/httpdocs/lib/private/AppFramework/Http/Dispatcher.php - line 217:

OCA\Settings\Controller\AdminSettingsController->index()

/var/www/vhosts/domain.tld/httpdocs/lib/private/AppFramework/Http/Dispatcher.php - line 126:

OC\AppFramework\Http\Dispatcher->executeController()

/var/www/vhosts/domain.tld/httpdocs/lib/private/AppFramework/App.php - line 157:

OC\AppFramework\Http\Dispatcher->dispatch()

/var/www/vhosts/domain.tld/httpdocs/lib/private/Route/Router.php - line 302:

OC\AppFramework\App::main()

/var/www/vhosts/domain.tld/httpdocs/lib/base.php - line 1006:

OC\Route\Router->match()

/var/www/vhosts/domain.tld/httpdocs/index.php - line 36:

OC::handleRequest()

TheColin21 avatar Nov 30 '21 22:11 TheColin21

same for me

CarlBishop avatar Feb 25 '22 22:02 CarlBishop

The likely culprit was this line of code just above the reported line:

                $interfaces = glob('/sys/class/net/*');

Likely at the time this was hitting up against an open_basedir() restriction (or similar).

However that was in NC23. We no longer get the list of network interfaces that way. We now use PHP's own net_get_interfaces() and that line of code is long gone.

Let's close this Issue out.

Please open a new issue if anything similar appears in a currently supported version of NC. It'll be for a different reason. :)

joshtrichards avatar May 28 '23 22:05 joshtrichards