nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.46k stars 4.08k forks source link

Undefined offset: 1 at /apps/files_external/lib/Lib/Storage/SMB.php#226 #27809

Closed anduz closed 3 years ago

anduz commented 3 years ago

How to use GitHub

Steps to reproduce

  1. Upgrade to NC 21.... and see logs

Expected behaviour

No errors, files:scan working for external files (SMB mounts)

Actual behaviour

Starting scan for user 1 out of 1 (user)
Exception during scan: Undefined offset: 1
#0 /var/www/owncloud/apps/files_external/lib/Lib/Storage/SMB.php(222): OCA\Files\Command\Scan->exceptionErrorHandler()
#1 /var/www/owncloud/apps/files_external/lib/Lib/Storage/SMB.php(254): OCA\Files_External\Lib\Storage\SMB->getACL()
#2 /var/www/owncloud/apps/files_external/lib/Lib/Storage/SMB.php(623): OCA\Files_External\Lib\Storage\SMB->getFolderContents()
#3 /var/www/owncloud/lib/private/Files/Storage/Wrapper/Encryption.php(205): OCA\Files_External\Lib\Storage\SMB->getDirectoryContent()
#4 [internal function]: OC\Files\Storage\Wrapper\Encryption->getDirectoryContent()
#5 /var/www/owncloud/lib/private/Files/Cache/Scanner.php(409): iterator_to_array()
#6 /var/www/owncloud/lib/private/Files/Cache/Scanner.php(389): OC\Files\Cache\Scanner->handleChildren()
#7 /var/www/owncloud/lib/private/Files/Cache/Scanner.php(341): OC\Files\Cache\Scanner->scanChildren()
#8 /var/www/owncloud/lib/private/Files/Utils/Scanner.php(260): OC\Files\Cache\Scanner->scan()
#9 /var/www/owncloud/apps/files/lib/Command/Scan.php(158): OC\Files\Utils\Scanner->scan()
#10 /var/www/owncloud/apps/files/lib/Command/Scan.php(214): OCA\Files\Command\Scan->scanFiles()
#11 /var/www/owncloud/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute()
#12 /var/www/owncloud/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run()
#13 /var/www/owncloud/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run()
#14 /var/www/owncloud/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand()
#15 /var/www/owncloud/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun()
#16 /var/www/owncloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#17 /var/www/owncloud/console.php(100): OC\Console\Application->run()
#18 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')
#19 {main}

Server configuration

Operating system: Ubuntu 20 (upgraded)

Web server: apache2

Database: Art: mysql Version: 8.0.25

PHP version: Version: 7.4.20

Nextcloud version: (see Nextcloud admin page) Nextcloud 21.0.3

Updated from an older Nextcloud/ownCloud or fresh install: Updated

Where did you install Nextcloud from: First was an image, then updated throu various channels and updater app

Signing status:

Signing status ``` Login as admin user into your Nextcloud and access http://example.com/index.php/settings/integrity/failed paste the results here. ``` No errors have been found.

List of activated apps:

App list ``` If you have access to your command line run e.g.: sudo -u www-data php occ app:list from within your Nextcloud installation folder ``` Enabled: - accessibility: 1.7.0 - activity: 2.14.3 - admin_audit: 1.11.0 - bruteforcesettings: 2.2.0 - calendar: 2.3.0 - cloud_federation_api: 1.4.0 - comments: 1.11.0 - contactsinteraction: 1.2.0 - dashboard: 7.1.0 - dav: 1.17.1 - encryption: 2.9.0 - federatedfilesharing: 1.11.0 - federation: 1.11.0 - files: 1.16.0 - files_external: 1.12.0 - files_fulltextsearch: 21.0.2 - files_linkeditor: 1.1.5 - files_pdfviewer: 2.1.0 - files_rightclick: 1.0.0 - files_sharing: 1.13.1 - files_trashbin: 1.11.0 - files_versions: 1.14.0 - files_videoplayer: 1.10.0 - firstrunwizard: 2.10.0 - fulltextsearch: 21.0.1 - fulltextsearch_elasticsearch: 21.0.1 - logreader: 2.6.0 - lookup_server_connector: 1.9.0 - maps: 0.1.8 - nextcloud_announcements: 1.10.0 - notifications: 2.9.0 - oauth2: 1.9.0 - onlyoffice: 7.0.2 - password_policy: 1.11.0 - photos: 1.3.0 - previewgenerator: 3.1.1 - privacy: 1.5.0 - provisioning_api: 1.11.0 - recommendations: 1.0.0 - serverinfo: 1.11.0 - settings: 1.3.0 - sharebymail: 1.11.0 - sharingpath: 0.3.0 - support: 1.4.0 - survey_client: 1.9.0 - systemtags: 1.11.0 - tasks: 0.13.6 - theming: 1.12.0 - twofactor_backupcodes: 1.10.0 - twofactor_totp: 6.1.0 - updatenotification: 1.11.0 - user_status: 1.1.1 - viewer: 1.5.0 - weather_status: 1.1.0 - workflowengine: 2.3.0 Disabled: - end_to_end_encryption - files_fulltextsearch_tesseract - nextbackup - sharerenamer - spreed - text - twofactor_admin - twofactor_gateway - user_ldap

Nextcloud configuration:

Config report ``` If you have access to your command line run e.g.: sudo -u www-data php occ config:list system from within your Nextcloud installation folder { "system": { "memcache.local": "\\OC\\Memcache\\APCu", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "25", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "localhost", "192.168.162.16", "192.168.162.15", "188.11.219.37", "office.instalbau.it" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "overwrite.cli.url": "https:\/\/office.instalbau.it\/", "dbtype": "mysql", "version": "21.0.3.1", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "logtimezone": "Europe\/Berlin", "loglevel": 0, "logfile": "\/var\/www\/owncloud\/data\/owncloud.log", "installed": true, "theme": "", "maintenance": false, "trashbin_retention_obligation": "auto", "preview_libreoffice_path": "\/usr\/bin\/libreoffice", "updatechecker": false, "htaccess.RewriteBase": "\/", "singleuser": true, "filelocking.enabled": true, "memcache.distributed": "\\OC\\Memcache\\Redis", "memcache.locking": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 0, "timeout": 0, "dbindex": 0, "password": "***REMOVED SENSITIVE VALUE***" }, "data-fingerprint": "412330b87d1afa463ac9fb11054275d0", "mail_sendmailmode": "smtp", "mysql.utf8mb4": true, "preview_max_x": "2048", "preview_max_y": "2048", "jpeg_quality": "60", "updater.secret": "***REMOVED SENSITIVE VALUE***", "default_phone_region": "IT" } } or Insert your config.php content here. Make sure to remove all sensitive content such as passwords. (e.g. database password, passwordsalt, secret, smtp password, …) ```

Are you using external storage, if yes which one: local/smb/sftp/... smb

Are you using encryption: yes/no no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/... no

Client configuration

Browser:

Operating system:

Logs

Web server error log

Web server error log ``` Insert your webserver log here {"reqId":"nstK8K9SLLIPIWaol2kc","level":3,"time":"2021-07-05T13:37:09+02:00","remoteAddr":"192.168.162.1","user":"roman","app":"PHP","method":"PROPFIND","url":"/remote.php/dav/files/roman/Firmendaten","message":{"Exception":"Error","Message":"Undefined offset: 1 at /var/www/owncloud/apps/files_external/lib/Lib/Storage/SMB.php#226","Code":0,"Trace":[{"file":"/var/www/owncloud/apps/files_external/lib/Lib/Storage/SMB.php","line":226,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/owncloud/apps/files_external/lib/Lib/Storage/SMB.php","line":258,"function":"getACL","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"file":"/var/www/owncloud/apps/files_external/lib/Lib/Storage/SMB.php","line":629,"function":"getFolderContents","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"file":"/var/www/owncloud/lib/private/Files/Storage/Wrapper/Encryption.php","line":205,"function":"getDirectoryContent","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"function":"getDirectoryContent","class":"OC\\Files\\Storage\\Wrapper\\Encryption","type":"->"},{"file":"/var/www/owncloud/lib/private/Files/Cache/Scanner.php","line":409,"function":"iterator_to_array"},{"file":"/var/www/owncloud/lib/private/Files/Cache/Scanner.php","line":389,"function":"handleChildren","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/owncloud/lib/private/Files/Cache/Scanner.php","line":341,"function":"scanChildren","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/owncloud/lib/private/Files/Cache/Watcher.php","line":106,"function":"scan","class":"OC\\Files\\Cache\\Scanner","type":"->"},{"file":"/var/www/owncloud/lib/private/Files/View.php","line":1350,"function":"update","class":"OC\\Files\\Cache\\Watcher","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/owncloud/lib/private/Files/View.php","line":1390,"function":"getCacheEntry","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/owncloud/apps/dav/lib/Connector/Sabre/Directory.php","line":223,"function":"getFileInfo","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":78,"function":"getChild","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":971,"function":"getNodeForPath","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1661,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1646,"function":"writeMultiStatus","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/owncloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":346,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/owncloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/owncloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/owncloud/apps/dav/lib/Server.php","line":332,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/owncloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/owncloud/remote.php","line":167,"args":["/var/www/owncloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/owncloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows) mirall/3.2.3stable-Win64 (build 20210624) (Nextcloud, windows-10.0.19043 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"21.0.2.1","id":"60e2eee5c3dba"} ```

Nextcloud log (data/nextcloud.log)

Nextcloud log ``` Insert your Nextcloud log here ```

Browser log

Browser log ``` Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ... ```
Spazzt commented 3 years ago

For me this error only occures when "Verify ACL access when listing files" on external storage is active. (External SMB Server in this case is 2012R2)

See forum post: https://help.nextcloud.com/t/undefined-offset-1-at-var-www-nextcloud-apps-files-external-lib-lib-storage-smb-php-219/91075

The actual error line moves with different nextcloud versions and patchlevels.

With 20.0.11 it is at line 222: Error: Undefined offset: 1 at /var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php#222

anduz commented 3 years ago

Thank you for this information, I disabled "Verify ACL access when listing files" and now files:scan is working again. After a reboot the error message is gone.