serverinfo icon indicating copy to clipboard operation
serverinfo copied to clipboard

[Bug]: Undefined array key with FreeBSD + jails

Open cyrilst opened this issue 3 years ago • 8 comments

⚠️ This issue respects the following points: ⚠️

  • [X] This is a bug, not a question or a configuration/webserver/proxy issue.
  • [X] This issue is not already reported on Github (I've searched it).
  • [X] Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • [X] I agree to follow Nextcloud's Code of Conduct.

Bug description

These errors appear in logs when I visit the page settings/admin/serverinfo:

Undefined array key 0 at /var/www/cloud/apps/serverinfo/lib/OperatingSystems/FreeBSD.php#140
Undefined array key 0 at /var/www/cloud/apps/serverinfo/lib/OperatingSystems/FreeBSD.php#183

The variables $gw and $speed are expected to be undefined in some cases (inside a FreeBSD jail), and should be checked (maybe with the empty() fuction?) before being used.

They are expected to be undefined, because there is no default gateway inside the jail, and there is no speed set for the bridge interface used in the jail.

Steps to reproduce

  1. in a FreeBSD system, create a jail
  2. in the jail, install php80
  3. in the jail, start php-fpm
  4. configure the web server tu use the php-fpm inside the jail
  5. log into the NextCloud instance
  6. click on settings
  7. in the admin section, click on serverinfo
  8. display is accurate (no gateway, and speed displays "unknown"), but error can now be found in the logs

Expected behavior

There should be no error in the logs.

Installation method

Manual installation

Operating system

Other

PHP engine version

PHP 8.0

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • [X] Default user-backend (database)
  • [ ] LDAP/ Active Directory
  • [ ] SSO - SAML
  • [ ] Other

Configuration report

No response

List of activated Apps

Enabled:
  - accessibility: 1.9.0
  - activity: 2.15.0
  - bruteforcesettings: 2.3.0
  - calendar: 3.2.0
  - circles: 23.0.1
  - cloud_federation_api: 1.6.0
  - comments: 1.13.0
  - contacts: 4.0.4
  - contactsinteraction: 1.4.0
  - dashboard: 7.3.0
  - dav: 1.21.0
  - federatedfilesharing: 1.13.0
  - federation: 1.13.0
  - files: 1.18.0
  - files_pdfviewer: 2.4.0
  - files_rightclick: 1.2.0
  - files_sharing: 1.15.0
  - files_trashbin: 1.13.0
  - files_versions: 1.16.0
  - files_videoplayer: 1.12.0
  - firstrunwizard: 2.12.0
  - logreader: 2.8.0
  - lookup_server_connector: 1.11.0
  - nextcloud_announcements: 1.12.0
  - notes: 4.3.1
  - notifications: 2.11.1
  - oauth2: 1.11.0
  - ocsms: 2.2.0
  - password_policy: 1.13.0
  - photos: 1.5.0
  - privacy: 1.7.0
  - provisioning_api: 1.13.0
  - recommendations: 1.2.0
  - serverinfo: 1.13.0
  - settings: 1.5.0
  - sharebymail: 1.13.0
  - systemtags: 1.13.0
  - text: 3.4.0
  - theming: 1.14.0
  - twofactor_backupcodes: 1.12.0
  - updatenotification: 1.13.0
  - user_status: 1.3.1
  - viewer: 1.7.0
  - workflowengine: 2.5.0
Disabled:
  - admin_audit
  - encryption
  - files_external
  - support: 1.6.0
  - survey_client: 1.11.0
  - user_ldap
  - weather_status: 1.0.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

No response

Additional info

This is not a critical bug, but as php 8.0 doesn't like accessing empty arrays, the arrays should just be checked before being accessed.

cyrilst avatar Mar 11 '22 16:03 cyrilst

For the first error, I added a pull request some time ago and it is waiting a review: https://github.com/nextcloud/serverinfo/pull/271

tflidd avatar Mar 14 '22 14:03 tflidd

Actually I think that's related to #270 and #358 . I just openend a pull request for those as well :) (Waiting for review)

KDederichs avatar May 05 '22 13:05 KDederichs

You mean this PR https://github.com/nextcloud/serverinfo/pull/372?

tflidd avatar May 14 '22 14:05 tflidd

Yeah that one/the backport PR's that come out of it

KDederichs avatar May 14 '22 15:05 KDederichs

so once the backport https://github.com/nextcloud/serverinfo/pull/373 is merged, we can close this.

tflidd avatar May 14 '22 16:05 tflidd

Yeah, I mean technically it's still missing the packport PR's for 23 and 22 but I have no clue how that backport bot works :D

KDederichs avatar May 15 '22 06:05 KDederichs

under a pull request you can just add /backport to stable24 and the bot will try to backport.

tflidd avatar May 16 '22 07:05 tflidd

Yeah, there's backport comments but it only created the one for 24, the one for 23 and 22 seem to be missing. Maybe they get queued up will 24 is merged?

KDederichs avatar May 16 '22 07:05 KDederichs

Looks like the backports got sorted out on the PRs. So this seems like it should be closed now, correct?

I can't test as I'm not using FreeBSD, but this looks to be in all currently supported releases (and then some at this point).

joshtrichards avatar May 29 '23 11:05 joshtrichards

Correct. I successfully tested 26.0.2 with FreeBSD + jails. Thanks for closing the issue.

cyrilst avatar May 29 '23 15:05 cyrilst