Error: must be of type string, bool given
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
- 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
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.
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
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.
I agree. The logic could be hardened a bit to check the response against false.