Nextcloud passwords generate PHP7.4 errors

hi,

I recently upgraded my server to php7.4 to take advantage of future updates to the application. This is my favorite application! I also upgraded to the latest version of nextcloud 20.02 earlier than what I usually choose to do. Version 18 didn’t work with php7.4 anymore, neither did version 19.
Nextcloud Passwors application in version 2020.11.1, then 2020.12.0 works perfectly in nextcloud and in Chrome and Firefox plugging. I also use the android application by daper (1.15) without any problem.
The php script dBigLocalDbSecurityCheckHelper.php in /var/www/nextcloud/apps/passwords/lib/Helper/SecurityCheck/ generates PHP errors in the nextcloud log every time the control task is called by cron.

-the script looks for files that no longer exist:

Error: unlink(/data/ncdata/tmp5fd036c022bb1.txt): No such file or directory at /var/www/nextcloud/apps/passwords/lib/Helper/SecurityCheck/BigLocalDbSecurityCheckHelper.php#147

<<closure>>

OC\Log\ErrorHandler::onError()

/var/www/nextcloud/apps/passwords/lib/Helper/SecurityCheck/BigLocalDbSecurityCheckHelper.php - line 147:

unlink()

or

Error: fopen(/data/ncdata/tmp5fd036c022bb1.txt): failed to open stream: No such file or directory at /var/www/nextcloud/apps/passwords/lib/Helper/SecurityCheck/BigLocalDbSecurityCheckHelper.php#123

<<closure>>

OC\Log\ErrorHandler::onError()

/var/www/nextcloud/apps/passwords/lib/Helper/SecurityCheck/BigLocalDbSecurityCheckHelper.php - line 123:

fopen()

or

Error: fgets() expects parameter 1 to be resource, bool given at /var/www/nextcloud/apps/passwords/lib/Helper/SecurityCheck/BigLocalDbSecurityCheckHelper.php - line 124:

<<closure>>

OC\Log\ErrorHandler::onError()

/var/www/nextcloud/apps/passwords/lib/Helper/SecurityCheck/BigLocalDbSecurityCheckHelper.php - line 124:
fgets()

or

Error: fclose() expects parameter 1 to be resource, bool given at /var/www/nextcloud/apps/passwords/lib/Helper/SecurityCheck/BigLocalDbSecurityCheckHelper.php#141

<<closure>>

OC\Log\ErrorHandler::onError()

/var/www/nextcloud/apps/passwords/lib/Helper/SecurityCheck/BigLocalDbSecurityCheckHelper.php - line 141:

fclose()

my server
Linux Armbian 20.11 Tamandua kernel linux cloud 5.4.77-odroidxu4
Apache/2.4.38
Mysql 10.3.25-MariaDB
Php 7.4.13
Nextcloud 20.0.2.2

do you have an idea about the origin?

konki

That looks like a buggy handling of the temp directory by the app. The path of the file should be someting like /data/ncdata/tmp/5fd036c022bb1.txt instead of /data/ncdata/tmp5fd036c022bb1.txt. The app expects the config value tempdirectory to always end with a “/”, but in this case it does not.

The app should probably also check if the result of fopen is actually a file handle and not an error code before attempting to use it.

I will add a patch to 2020.12.1 that fixes both issues. In the meantime, adding a “/” to the tempdirectory setting should fix the issue.

thank you for your answer, I look forward to the update. I forgot the first error at the very beginning of the logging list:

Error: rename(/data/ncdata/tmp10-million-combos.txt,/data/ncdata/tmp5fcd903598621.txt): No such file or directory at /var/www/nextcloud/apps/passwords/lib/Helper/SecurityCheck/BigLocalDbSecurityCheckHelper.php#99

<<closure>>

OC\Log\ErrorHandler::onError()

/var/www/nextcloud/apps/passwords/lib/Helper/SecurityCheck/BigLocalDbSecurityCheckHelper.php - line 99:

rename()

konki

the application doesn’t generate any more errors since I chose 1M passwords (local) instead of 10M passwords (local). The server still operates using nextcloud 20.0.2.2

konki