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

Error: must be of type string, bool given #387

Open
sachaz opened this issue Oct 15, 2024 · 2 comments
Open

Error: must be of type string, bool given #387

sachaz opened this issue Oct 15, 2024 · 2 comments

Comments

@sachaz
Copy link

sachaz commented Oct 15, 2024

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Upload file from ChromeOS 127

Expected behaviour

FIle should be sent with no antivirus issue

Actual behaviour

File cause an error from the Clamav plugin: "must be of type string, bool given"
If the module filas_antivirus is disabled the ChromeOS upload works fine.
There is no upload issue on other OSes

Server configuration

Web server: Nginx

Database: Maria

PHP version: 8.2

Nextcloud version: 29

List of activated apps
Enabled:
  - activity: 2.21.1
  - circles: 29.0.0-dev
  - cloud_federation_api: 1.12.0
  - collectives: 2.14.4
  - comments: 1.19.0
  - contactsinteraction: 1.10.0
  - dashboard: 7.9.0
  - dav: 1.30.1
  - federatedfilesharing: 1.19.0
  - federation: 1.19.0
  - files: 2.1.1
 - files_antivirus: 5.6.0 (installed 5.6.0)
  - files_downloadlimit: 2.0.0
  - files_pdfviewer: 2.10.0
  - files_reminders: 1.2.0
  - files_sharing: 1.21.0
  - files_trashbin: 1.19.0
  - files_versions: 1.22.0
  - firstrunwizard: 2.18.0
  - groupfolders: 17.0.5
  - impersonate: 1.16.0
  - integration_collaboard: 1.0.10
  - lookup_server_connector: 1.17.0
  - maps: 1.4.0
  - notes: 4.11.0
  - notifications: 2.17.0
  - oauth2: 1.17.1
  - password_policy: 1.19.0
  - photos: 2.5.0
  - privacy: 1.13.0
  - provisioning_api: 1.19.0
  - recommendations: 2.1.0
  - related_resources: 1.4.0
  - richdocuments: 8.4.7
  - settings: 1.12.0
  - sharebymail: 1.19.0
  - systemtags: 1.19.0
  - text: 3.10.1
  - theming: 2.4.0
  - twofactor_backupcodes: 1.18.0
  - user_status: 1.9.0
  - viewer: 2.3.0
  - weather_status: 1.9.0
  - workflowengine: 2.11.0
Disabled:
  - admin_audit: 1.19.0
  - bbb: 2.7.2 (installed 2.7.2)
  - bruteforcesettings: 2.9.0
  - encryption: 2.17.0
  - files_external: 1.21.0
  - files_rightclick: 0.15.1 (installed 1.6.0)
  - logreader: 2.14.0 (installed 2.13.0)
  - nextcloud_announcements: 1.18.0 (installed 1.16.0)
  - serverinfo: 1.19.0 (installed 1.17.0)
  - support: 1.12.0 (installed 1.10.0)
  - survey_client: 1.17.0 (installed 1.15.0)
  - suspicious_login: 7.0.0
  - twofactor_totp: 11.0.0-dev
  - updatenotification: 1.19.1 (installed 1.17.0)
  - user_ldap: 1.20.0

Nextcloud configuration
{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "29.0.8.1",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "sendmail",
        "mail_sendmailmode": "smtp",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "25",
        "trashbin_retention_obligation": "7,30",
        "log_type": "syslog",
        "logfile": "",
        "loglevel": "1",
        "syslog_tag": "YYY",
        "updater.server.url": "***REMOVED SENSITIVE VALUE***",
        "skeletondirectory": "",
        "app_install_overwrite": [
            "x"
        ],
        "x_cookie": "om",
        "x_redis": {
            "host": "localhost",
            "port": "6379",
            "db": "1"
        },
        "auth.webauthn.enabled": false,
        "allow_user_to_change_display_name": true,
        "defaultapp": "files",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": "0",
            "dbindex": "0",
            "timeout": "1.5"
        },
        "memcache.local": "\\OC\\Memcache\\Redis",
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "default_phone_region": "fr",
        "default_language": "fr",
        "maintenance": false,
        "maintenance_window_start": "2"
    }
}

Operating system: ChromeOS 127.0.6533.132

Nextcloud Log

oct. 15 12:52:41 XXX ZZZ[3404498]: {"reqId":"wd3FrVcy1mgXbSEnVX9w","level":3,"time":"2024-10-15T10:52:41+00:00","remoteAddr":"XXX.XXX.XXX.XXX","user":"--","app":"webdav","method":"PUT","url":"/public.php/webdav/2_VIDEOS/a.mp4","message":"{\"Exception\":\"TypeError\",\"Message\":\"OCA\\\\Files_Antivirus\\\\Status::parseResponse(): Argument #1 ($rawResponse) must be of type string, bool given, called in /YYY/apps/files_antivirus/lib/Scanner/ExternalClam.php on line 74\",\"Code\":0,\"Trace\":[{\"file\":\"/YYY/apps/files_antivirus/lib/Scanner/ExternalClam.php\",\"line\":74,\"function\":\"parseResponse\",\"class\":\"OCA\\\\Files_Antivirus\\\\Status\",\"type\":\"->\"},{\"file\":\"/YYY/apps/files_antivirus/lib/Scanner/ScannerBase.php\",\"line\":166,\"function\":\"shutdownScanner\",\"class\":\"OCA\\\\Files_Antivirus\\\\Scanner\\\\ExternalClam\",\"type\":\"->\"},{\"file\":\"/YYY/apps/files_antivirus/lib/Scanner/ScannerBase.php\",\"line\":139,\"function\":\"fwrite\",\"class\":\"OCA\\\\Files_Antivirus\\\\Scanner\\\\ScannerBase\",\"type\":\"->\"},{\"file\":\"/YYY/apps/files_antivirus/lib/Scanner/ScannerBase.php\",\"line\":107,\"function\":\"writeChunk\",\"class\":\"OCA\\\\Files_Antivirus\\\\Scanner\\\\ScannerBase\",\"type\":\"->\"},{\"file\":\"/YYY/apps/files_antivirus/lib/AvirWrapper.php\",\"line\":102,\"function\":\"onAsyncData\",\"class\":\"OCA\\\\Files_Antivirus\\\\Scanner\\\\ScannerBase\",\"type\":\"->\",\"args\":[\"*** sensitive parameters replaced ***\"]},{\"function\":\"OCA\\\\Files_Antivirus\\\\{closure}\",\"class\":\"OCA\\\\Files_Antivirus\\\\AvirWrapper\",\"type\":\"->\",\"args\":[\"*** sensitive parameters replaced ***\"]},{\"file\":\"/YYY/apps/files_antivirus/lib/CallbackReadDataWrapper.php\",\"line\":60,\"function\":\"call_user_func\"},{\"function\":\"stream_read\",\"class\":\"OCA\\\\Files_Antivirus\\\\CallbackReadDataWrapper\",\"type\":\"->\"},{\"file\":\"/YYY/lib/private/Files/Storage/Local.php\",\"line\":339,\"function\":\"file_put_contents\"},{\"file\":\"/YYY/lib/private/Files/Storage/Local.php\",\"line\":650,\"function\":\"file_put_contents\",\"class\":\"OC\\\\Files\\\\Storage\\\\Local\",\"type\":\"->\"},{\"file\":\"/YYY/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":653,\"function\":\"writeStream\",\"class\":\"OC\\\\Files\\\\Storage\\\\Local\",\"type\":\"->\"},{\"file\":\"/YYY/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":653,\"function\":\"writeStream\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\"},{\"file\":\"/YYY/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":653,\"function\":\"writeStream\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\"},{\"file\":\"/YYY/apps/files_antivirus/lib/AvirWrapper.php\",\"line\":84,\"function\":\"writeStream\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\"},{\"file\":\"/YYY/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":653,\"function\":\"writeStream\",\"class\":\"OCA\\\\Files_Antivirus\\\\AvirWrapper\",\"type\":\"->\"},{\"file\":\"/YYY/lib/private/Files/Storage/Wrapper/Jail.php\",\"line\":520,\"function\":\"writeStream\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\"},{\"file\":\"/YYY/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":653,\"function\":\"writeStream\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Jail\",\"type\":\"->\"},{\"file\":\"/YYY/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":653,\"function\":\"writeStream\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\"},{\"file\":\"/YYY/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":653,\"function\":\"writeStream\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\"},{\"file\":\"/YYY/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":653,\"function\":\"writeStream\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\"},{\"file\":\"/YYY/lib/private/Files/Storage/Wrapper/Wrapper.php\",\"line\":653,\"function\":\"writeStream\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\"},{\"file\":\"/YYY/apps/dav/lib/Connector/Sabre/File.php\",\"line\":250,\"function\":\"writeStream\",\"class\":\"OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper\",\"type\":\"->\"},{\"file\":\"/YYY/apps/dav/lib/Connector/Sabre/Directory.php\",\"line\":148,\"function\":\"put\",\"class\":\"OCA\\\\DAV\\\\Connector\\\\Sabre\\\\File\",\"type\":\"->\"},{\"file\":\"/YYY/3rdparty/sabre/dav/lib/DAV/Server.php\",\"line\":1098,\"function\":\"createFile\",\"class\":\"OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Directory\",\"type\":\"->\",\"args\":[\"*** sensitive parameters replaced ***\"]},{\"file\":\"/YYY/3rdparty/sabre/dav/lib/DAV/CorePlugin.php\",\"line\":504,\"function\":\"createFile\",\"class\":\"Sabre\\\\DAV\\\\Server\",\"type\":\"->\",\"args\":[\"*** sensitive parameters replaced ***\"]},{\"file\":\"/YYY/3rdparty/sabre/event/lib/WildcardEmitterTrait.php\",\"line\":89,\"function\":\"httpPut\",\"class\":\"Sabre\\\\DAV\\\\CorePlugin\",\"type\":\"->\"},{\"file\":\"/YYY/3rdparty/sabre/dav/lib/DAV/Server.php\",\"line\":472,\"function\":\"emit\",\"class\":\"Sabre\\\\DAV\\\\Server\",\"type\":\"->\"},{\"file\":\"/YYY/apps/dav/lib/Connector/Sabre/Server.php\",\"line\":61,\"function\":\"invokeMethod\",\"class\":\"Sabre\\\\DAV\\\\Server\",\"type\":\"->\"},{\"file\":\"/YYY/3rdparty/sabre/dav/lib/DAV/Server.php\",\"line\":321,\"function\":\"start\",\"class\":\"OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Server\",\"type\":\"->\"},{\"file\":\"/YYY/apps/dav/appinfo/v1/publicwebdav.php\",\"line\":124,\"function\":\"exec\",\"class\":\"Sabre\\\\DAV\\\\Server\",\"type\":\"->\"},{\"file\":\"/YYY/public.php\",\"line\":107,\"args\":[\"/YYY/apps/dav/appinfo/v1/publicwebdav.php\"],\"function\":\"require_once\"}],\"File\":\"/YYY/apps/files_antivirus/lib/Status.php\",\"Line\":86,\"message\":\"OCA\\\\Files_Antivirus\\\\Status::parseResponse(): Argument #1 ($rawResponse) must be of type string, bool given, called in /YYY/apps/files_antivirus/lib/Scanner/ExternalClam.php on line 74\",\"exception\":{},\"CustomMessage\":\"OCA\\\\Files_Antivirus\\\\Status::parseResponse(): Argument #1 ($rawResponse) must be of type string, bool given, called in /YYY/apps/files_antivirus/lib/Scanner/ExternalClam.php on line 74\"}","userAgent":"Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36","version":"29.0.8.1"}
@alx-tuilmenau
Copy link

Got a similar error, but in a different context:

OCA\Files_Antivirus\Status::parseResponse(): Argument #1 ($rawResponse) must be of type string, bool given, called in /data/nextcloud/apps/files_antivirus/lib/Scanner/ExternalClam.php on line 74

NC 29.0.9, files_antivirus 5.6.0

But in my case, the message is "only" ugly, but it shows a real problem with clamav. The $rawResponse is bool "false", but the checked "stream_get_meta_data" timeout in the function shutdownScanner in Scanner/ExternalClam.php is also false (because the clamav daemon segfaulted during scanning :( ). Maybe it will be a good idea, not only to check the timed_out from the metadata, but also direct $response===false there, to check if the fgets fails.

@vincib
Copy link

vincib commented Nov 21, 2024

I found the same bug today on another nextcloud :

log:

"MOVE /remote.php/dav/uploads/xxx/150423853/.file HTTP/1.1" 500 1281 "-" "Mozilla/5.0 
(Windows) mirall/3.14.3stable-Win64 (build 20241031) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)" 
{"reqId":"xxx","level":3,"time":"2024-11-19T00:59:34+00:00","remoteAddr":"xxx","user":"xxx","app":"webdav","method":"MOVE","url":"/remote.php/dav/uploads/xxx/2329250795/.file","message":"{\"Exception\":\"TypeError\",\"Message\":\"OCA\\\\Files_Antivirus\\\\Status::parseResponse(): Argument #1 ($rawResponse) must be of type string, bool given, called in /srv/cloud32/apps/files_antivirus/lib/Scanner/ExternalClam.php on line 74\",\"Code\":0,\"Trace\":[{\"file\":\"/srv/cloud32/apps/files_antivirus/lib/Scanner/ExternalClam.php\",\"line\":74,\"function\":\"parseResponse\",\"class\":\"OCA\\\\Files_Antivirus\\\\Status\",\"type\":\"->\"},
...
[\"/srv/cloud32/apps/dav/appinfo/v2/remote.php\"],\"function\":\"require_once\"}],\"File\":\"/srv/cloud32/apps/files_antivirus/lib/Status.php\",\"Line\":86,\"message\":\"OCA\\\\Files_Antivirus\\\\Status::parseResponse(): Argument #1 ($rawResponse) must be of type string, bool given, called in /srv/cloud32/apps/files_antivirus/lib/Scanner/ExternalClam.php on line 74\",\"exception\":{},\"CustomMessage\":\"OCA\\\\Files_Antivirus\\\\Status::parseResponse(): Argument #1 ($rawResponse) must be of type string, bool given, called in /srv/cloud32/apps/files_antivirus/lib/Scanner/ExternalClam.php on line 74\"}","userAgent":"Mozilla/5.0 (Windows) mirall/3.14.3stable-Win64 (build 20241031) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"28.0.11.1"}

NC 28.0.11, Antivirus for files 5.6.0

It's not a chromeOS but the sync client

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

No branches or pull requests

3 participants