Trash bin: AbstractTrash::getSize() must be of the type integer, float returned
Steps to reproduce
(I am unsure about this, as I cannot set up another test instance.)
- Delete any file
- Visit trash bin in app or web interface 3.
Expected behaviour
The trash bin should open, showing deleted files.
Actual behaviour
In the web client, the trash bin does nothing but show the loading spinner. The Android app shows an error instead.
Server configuration
Operating system: Raspbian stretch
Web server: Apache 2.4.25-3
Database: MariaDB 10.1.37-0
PHP version: PHP 7.0.30
Nextcloud version: 15.0.0
Updated from an older Nextcloud/ownCloud or fresh install: upgraded from 14.0.4, 13.0.6, 12.0.4
Where did you install Nextcloud from: zip file
Signing status:
Signing status
No errors have been found.
List of activated apps:
App list
Enabled:
- accessibility: 1.1.0
- activity: 2.8.2
- admin_audit: 1.5.0
- announcementcenter: 3.4.0
- apporder: 0.6.0
- audioplayer: 2.5.0
- bookmarks: 0.14.3
- bruteforcesettings: 1.3.0
- calendar: 1.6.4
- camerarawpreviews: 0.6.3
- cloud_federation_api: 0.1.0
- comments: 1.5.0
- contacts: 3.0.0
- data_request: 1.2.0
- dav: 1.8.0
- event_update_notification: 0.3.1
- federatedfilesharing: 1.5.0
- federation: 1.5.0
- files: 1.10.0
- files_downloadactivity: 1.4.0
- files_external: 1.6.0
- files_markdown: 2.0.5
- files_pdfviewer: 1.4.0
- files_sharing: 1.7.0
- files_texteditor: 2.7.0
- files_trashbin: 1.5.0
- files_versions: 1.8.0
- files_videoplayer: 1.4.0
- firstrunwizard: 2.4.0
- gallery: 18.2.0
- gpxedit: 0.0.10
- groupfolders: 2.0.2
- logreader: 2.0.0
- lookup_server_connector: 1.3.0
- metadata: 0.8.0
- news: 13.0.3
- nextcloud_announcements: 1.4.0
- notes: 2.5.1
- notifications: 2.3.0
- oauth2: 1.3.0
- password_policy: 1.5.0
- phonetrack: 0.4.0
- previewgenerator: 2.0.0
- provisioning_api: 1.5.0
- qownnotesapi: 18.11.0
- ransomware_protection: 1.3.0
- serverinfo: 1.5.0
- sharebymail: 1.5.0
- sharerenamer: 2.3.0
- spreed: 5.0.0
- support: 1.0.0
- survey_client: 1.3.0
- systemtags: 1.5.0
- tasks: 0.9.8
- theming: 1.6.0
- twofactor_admin: 0.2.0
- twofactor_backupcodes: 1.4.1
- twofactor_nextcloud_notification: 1.0.1
- twofactor_totp: 2.1.0
- updatenotification: 1.5.0
- workflow_script: 1.0.0
- workflowengine: 1.5.0
Disabled:
- checksum
- circles
- cms_pico
- encryption
- files_accesscontrol
- files_rightclick
- flowupload
- keeweb
- ocdownloader
- polls
- socialsharing_email
- user_external
- user_ldap
Nextcloud configuration:
Config report
{
"system": {
"instanceid": "***REMOVED SENSITIVE VALUE***",
"passwordsalt": "***REMOVED SENSITIVE VALUE***",
"secret": "***REMOVED SENSITIVE VALUE***",
"trusted_domains": [
"1",
"2",
"3",
"4",
"5",
"6"
],
"datadirectory": "***REMOVED SENSITIVE VALUE***",
"overwrite.cli.url": "https:\/\/1",
"htaccess.RewriteBase": "\/",
"dbtype": "mysql",
"version": "15.0.0.10",
"dbname": "***REMOVED SENSITIVE VALUE***",
"dbhost": "***REMOVED SENSITIVE VALUE***",
"dbport": "",
"dbtableprefix": "oc_",
"dbuser": "***REMOVED SENSITIVE VALUE***",
"dbpassword": "***REMOVED SENSITIVE VALUE***",
"installed": true,
"mail_smtpmode": "smtp",
"mail_smtpauthtype": "LOGIN",
"memcache.local": "\\OC\\Memcache\\APCu",
"filelocking.enabled": true,
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "***REMOVED SENSITIVE VALUE***",
"port": 0,
"timeout": 0
},
"loglevel": 1,
"mail_smtpsecure": "ssl",
"maintenance": false,
"theme": "",
"mysql.utf8mb4": true,
"updater.release.channel": "stable",
"enable_previews": true,
"enabledPreviewProviders": [
"OC\\Preview\\PNG",
"OC\\Preview\\JPEG",
"OC\\Preview\\GIF",
"OC\\Preview\\BMP",
"OC\\Preview\\XBitmap",
"OC\\Preview\\MP3",
"OC\\Preview\\TXT",
"OC\\Preview\\MarkDown",
"OC\\Preview\\Movie"
],
"mail_from_address": "***REMOVED SENSITIVE VALUE***",
"mail_domain": "***REMOVED SENSITIVE VALUE***",
"mail_smtphost": "***REMOVED SENSITIVE VALUE***",
"mail_smtpport": "465",
"mail_smtpauth": 1,
"mail_smtpname": "***REMOVED SENSITIVE VALUE***",
"mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
"debug": true
}
}
Are you using external storage, if yes which one: no
Are you using encryption: no
Are you using an external user-backend, if yes which one: no
Client configuration
Browser: Firefox 64
Operating system: Windows 10
Logs
Web server error log
Web server error log
(No errors)
Nextcloud log (data/nextcloud.log)
Nextcloud log
{"reqId":"cz7cQ2vFEo2wFR8K33gm","level":3,"time":"2018-12-19T13:40:33+00:00","remoteAddr":"1.2.3.4","user":"christopher","app":"remote","method":"PROPFIND","url":"\/remote.php\/dav\/trashbin\/christopher\/trash","message":{"Exception":"TypeError","Message":"Return value of OCA\\Files_Trashbin\\Sabre\\AbstractTrash::getSize() must be of the type integer, float returned","Code":0,"Trace":[{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/PropFind.php","line":98,"function":"getSize","class":"OCA\\Files_Trashbin\\Sabre\\AbstractTrash","type":"->","args":[]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":797,"function":"handle","class":"Sabre\\DAV\\PropFind","type":"->","args":["{DAV:}getcontentlength",[{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"},"getSize"]]},{"function":"propFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"propFind"],[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":1059,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["propFind",[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":981,"function":"getPropertiesByNode","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\Files_Trashbin\\Sabre\\TrashFile"}]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":1666,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->","args":["trashbin\/christopher\/trash",["{http:\/\/nextcloud.org\/ns}trashbin-filename","{http:\/\/nextcloud.org\/ns}trashbin-deletion-time","{DAV:}getlastmodified","{DAV:}getetag","{DAV:}getcontenttype","{DAV:}resourcetype","{http:\/\/owncloud.org\/ns}fileid","{http:\/\/owncloud.org\/ns}permissions","{http:\/\/owncloud.org\/ns}size","{DAV:}getcontentlength","{http:\/\/nextcloud.org\/ns}has-preview","{http:\/\/nextcloud.org\/ns}mount-type","{http:\/\/nextcloud.org\/ns}is-encrypted","{http:\/\/open-collaboration-services.org\/ns}share-permissions","{http:\/\/owncloud.org\/ns}comments-unread"],1]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/CorePlugin.php","line":355,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Generator"},false]},{"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/event\/lib\/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpPropFind"],[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:PROPFIND",[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"\/var\/www\/html\/3rdparty\/sabre\/dav\/lib\/DAV\/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https:\/\/1\/remote.php\/dav\/trashbin\/christopher\/trash","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"\/var\/www\/html\/apps\/dav\/lib\/Server.php","line":298,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/html\/apps\/dav\/appinfo\/v2\/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"\/var\/www\/html\/remote.php","line":163,"args":["\/var\/www\/html\/apps\/dav\/appinfo\/v2\/remote.php"],"function":"require_once"}],"File":"\/var\/www\/html\/apps\/files_trashbin\/lib\/Sabre\/AbstractTrash.php","Line":59,"CustomMessage":"--"},"userAgent":"Mozilla\/5.0 (Windows NT 10.0; Win64; x64; rv:64.0) Gecko\/20100101 Firefox\/64.0","version":"15.0.0.10"}
Browser log
Browser log
Same here, fresh install Nextcloud 15. Is there a clean way to manually remove deleted files?
Edit: I had to clear some space so I just removed all files inside trash folder. The "Deleted files" in web GUI is still not loading.
Edit2: cleared database by using: sudo -u www-data php occ trashbin:cleanup --all-users
It might be related to FileInfo Size Function not converting the data field to integer properly, if it is already float.
Same behaviour with Nextcloud 15.0.2.0. In error log I found an TypeError:
Return value of OCA\Files_Trashbin\Sabre\AbstractTrash::getSize() must be of the type integer, float returned
/www/cloud/apps/files_trashbin/lib/Sabre/PropfindPlugin.php - line 78:
OCA\Files_Trashbin\Sabre\AbstractTrash->getSize()
/www/cloud/3rdparty/sabre/dav/lib/DAV/PropFind.php - line 98:
OCA\Files_Trashbin\Sabre\PropfindPlugin->OCA\Files_Trashbin\Sabre\{closure}("*** sensiti ... *")
/www/cloud/apps/files_trashbin/lib/Sabre/PropfindPlugin.php - line 79:
Sabre\DAV\PropFind->handle("{http://owncloud.org/ns}size", Closure {})
<<closure>>
OCA\Files_Trashbin\Sabre\PropfindPlugin->propFind(Sabre\DAV\PropFind {}, OCA\Files_Tr ... {})
/www/cloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:
call_user_func_array([ OCA\Files_ ... "], [ Sabre\DAV\ ... }])
/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1059:
Sabre\Event\EventEmitter->emit("propFind", [ Sabre\DAV\ ... }])
/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 981:
Sabre\DAV\Server->getPropertiesByNode(Sabre\DAV\PropFind {}, OCA\Files_Tr ... {})
/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1666:
Sabre\DAV\Server->getPropertiesIteratorForPath("trashbin/frank/trash", [ "{http://n ... "], 1)
/www/cloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 355:
Sabre\DAV\Server->generateMultiStatus(Generator {}, false)
<<closure>>
Sabre\DAV\CorePlugin->httpPropFind(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})
/www/cloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105:
call_user_func_array([ Sabre\DAV\ ... "], [ Sabre\HTTP ... }])
/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479:
Sabre\Event\EventEmitter->emit("method:PROPFIND", [ Sabre\HTTP ... }])
/www/cloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254:
Sabre\DAV\Server->invokeMethod(Sabre\HTTP\R ... "}, Sabre\HTTP\Response {})
/www/cloud/apps/dav/lib/Server.php - line 301:
Sabre\DAV\Server->exec()
/www/cloud/apps/dav/appinfo/v2/remote.php - line 35:
OCA\DAV\Server->exec()
/www/cloud/remote.php - line 163:
require_once("/www/cloud/ ... p")`
I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:
public function getSize(): int {
return (int)$this->data->getSize();
}
I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:
public function getSize(): int { return (int)$this->data->getSize(); }
It works for me too, thanks!
Had the same problem, found this issue by Google, thanks for the exact Nextcloud-log. Solved it by the following answer https://github.com/nextcloud/server/issues/13160#issuecomment-450574292:
Edit2: cleared database by using:
sudo -u www-data php occ trashbin:cleanup --all-users
@bdstr @bzfwunde maybe do an pull request?
I fixed it locally by explicitly casting to int in method getSize() in AbstractTrash.php. It now looks like this now:
public function getSize(): int { return (int)$this->data->getSize(); }It works for me too, thanks!
This worked for me Can you include this in the nextcloud code?
This worked for me Can you include this in the nextcloud code?
Bad idea. If you running nextcloud on a raspberry pi (and use a 32bit operating system) files larger than ~4gb are to big for int. What is wrong here is the typed return type.
this worked for me too but the files were 2,5 GB not bigger than 4 what happens when deleting files with over 4 GB size?
Same for me, fix doesn´t work cause it´s already applied in AbstractTrash.php. Running on a Raspberry Pi with NC v15.0.5.3, deleted files totally at least 8 to 9 GB. No way to recover... horrible, I´m lost :-(
Update: When I change the "public function getSize(): int {" to "public function getSize(): float {" in AbstractTrash.php, trashbin page loads immediately. So where the int is a fix for some, it gets me in big troubles. Definitely NOT closed!
@rullzer @MorrisJobke https://github.com/brick/math could be a possible solution. I'm not affected by this problem but it would be cool to have it fixed. Keep in mind you recommend nextcloud for raspberry. Using int for $size will not work there for large files.
This is still a problem in nextcloud version 15.0.8.1. I got around it by editing AbstractTrash.php and putting intval around the return statement for getSize.
I tried using changing the return value to float and that worked too.
I can confirm the problem at the image NextCloudPi_RPi_03-09-19. I updated to nextcloud 16.0.1.1. The trash bin has been unusable after I dropped a 3.8 gb file in it.
I have faced the same issue. workaroud: sudo -u www-data php occ trashbin:cleanup --all-users Nextcloud 16.0.1 hardware: Tinkerboard S OS: Armbian 5.77 kernel: 4.19.41-rockchip php: 7.2.19
Thx for the info! I can confirm that helped.
Hello, I have NC 16.0.3 and i detected this error. I read the thread and have no clear solution. Please, could you clarify? Thanks
Hello, I have NC 16.0.3 and i detected this error. I read the thread and have no clear solution. Please, could you clarify? Thanks
As openterprise stated the following console command forces the trashbin to empty: sudo -u www-data php occ trashbin:cleanup --all-users
You either have to login to the nextcloud locally or via ssh.
In my case it is a nextcloudpi and it said it didn't the file occ. In that case I had to change the command to where my occ is, i. e. : sudo -u www-data php /var/www/nextcloud/occ trashbin:cleanup --all-users
This happend right now (using nextcloud 16.0.3, tarball on Rasbian Buster with PHP 7.3). I started to upload ~8GB of files via WiFi (only images and videos <1GB), cancelled the upload, marked all files and deleted them, switched to LAN, reloaded nextcloud, startet to upload again. I couldn't open the trash bin, neither through the web interface nor the app. The upload was fine, no other errors occured.
Deleting other files moved them to the trash correctly (verified through file system access), but I couldn't delete them.
Using sudo -u www-data php occ trashbin:cleanup <affected user's ID> I was able to regain access to the trash bin.
Same issue just faced on v16.0.4 RC1, on an RPi2.