Scan problem after update from 26 to 27

Hello after upgrading from version 26 to 27 when i run

sudo -u www-data php /var/www/html/nextcloud/occ files:scan --all

i got this

Starting scan for user 1 out of 1 (massimo)
An unhandled exception has been thrown:
TypeError: OC\Files\Cache\Scanner::scanChildren(): Argument #6 ($oldSize) must be of type int, float given, called in /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php on line 347 and defined in /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php:391
Stack trace:
#0 /var/www/html/nextcloud/lib/private/Files/Cache/Scanner.php(347): OC\Files\Cache\Scanner->scanChildren()
#1 /var/www/html/nextcloud/lib/private/Files/Utils/Scanner.php(269): OC\Files\Cache\Scanner->scan()
#2 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(164): OC\Files\Utils\Scanner->scan()
#3 /var/www/html/nextcloud/apps/files/lib/Command/Scan.php(219): OCA\Files\Command\Scan->scanFiles()
#4 /var/www/html/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OCA\Files\Command\Scan->execute()
#5 /var/www/html/nextcloud/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run()
#6 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run()
#7 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#8 /var/www/html/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#9 /var/www/html/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#10 /var/www/html/nextcloud/console.php(100): OC\Console\Application->run()
#11 /var/www/html/nextcloud/occ(11): require_once(‘…’)

any suggestion?

Did you change anything else on your server?

after error i tried upgrade php from 8.0 to 8.2 but nothing changed

Bingo.

Look if only one php version is installed with this command:

dpkg -l | awk '/^ii.*php/ {print $2}'

Is it only 8.2 or are there some older php versions somewhere not yet deinstalled?

Look what php is used by your apache webserver with this command:

apachectl -tD DUMP_INCLUDES | sed -n '/php.*conf/ s#.*/\([^/]*\)\.conf#\1#p'

Is there only one or multiple lines and does it match? Is it 8.2 as well?

If not, fix that first.

Aditionaly look here: Upgrade PHP 8.0 to 8.2 - #2 by ernolf

Hope that helps,
much luck!

Hello
I deleted all previous versions :
apachectl -tD DUMP_INCLUDES | sed -n ‘/php.conf/ s#./([^/]*).conf#\1#p’
php8.2

dpkg -l | awk ‘/^ii.*php/ {print $2}’
libapache2-mod-php8.2
php-common
php8.2
php8.2-bcmath
php8.2-bz2
php8.2-cli
php8.2-common
php8.2-curl
php8.2-fpm
php8.2-gd
php8.2-igbinary
php8.2-imagick
php8.2-imap
php8.2-intl
php8.2-mbstring
php8.2-mysql
php8.2-opcache
php8.2-readline
php8.2-redis
php8.2-xml
php8.2-zip

but same error

:sleepy:

Thenks again

Good. Thus, a possible source of error is at least ruled out.

Too bad. :thinking:

Did you try to scan user by user instead of --all:

sudo -u www-data php /var/www/html/nextcloud/occ files:scan -vvv --home-only -- massimo

With the verbose flag -vvv you may see if it happens at a certain file that may be broken.

Hope that helps,
much luck!

Same Problem here, tried scanning single user => same.

It’s a 32bit Raspberry Pi.

I have the same issue. 32-bit PHP 8.1 on Raspberry Pi 3. If you change the type of parameter 6 from int to float on line 391 the scanner runs. I have never looked at the nextcloud code nor do I have any knowledge of any of its workings. I am just letting people know the scanner completes if making this change. I am not sure of any of the other consequences this might bring.

2 Likes

Editing Nextclouds code is way out of my comfort zone. But since there seemed to other options, I did it anyway as suggested by sruckh and it worked. Thank you!

Scan is currently running for the last user and I will revert it to int as soon as that finishes because I am so scared of meddling inside NC code base.

From the error message this seems to be a plain bug in scanner.php: inconsistent data types within the same file. Or am I wrong, is there anything the user could do to avoid this?

This also has been happening to me, and this solution fixes it. @Supermax this should fix your problem as well.

This seems to be related to this PR, seeing as that’s where int $oldSize was first added:

once this other PR is merged, this issue should be resolved.