Novik / ruTorrent

Yet another web front-end for rTorrent
Other
2.01k stars 408 forks source link

Server 500: array_diff(): Argument #1 ($array) must be of type array, false given in /var/www/ruTorrent-4.3.5/php/utility/fileutil.php when using php8.3 #2681

Closed wmarler closed 2 months ago

wmarler commented 2 months ago

Please complete the following tasks.

Tell us about your environment

Web Browser: Brave Version 1.67.119 Chromium: 126.0.6478.114 (Official Build) unknown (64-bit) rutorrent: 4.3.5 PHP: 8.3.8-2+ubuntu22.04 OS: Server: Ubuntu 22.04.3 LTS Client: Arch

Tell us how you installed ruTorrent

This is an upgrade from ruTorrent-3.1.0 . I also tried upgrading from php7.4 to php8.3

With php7.4 enabled, rutorrent works ok.

Describe the bug

After disabling the php7.4 module, enabling the php8.3 module, and restarting apache2, the rutorrent web page does not properly load. The main window renders, some of the buttons across the top render, and inside the main frame the following is displayed

[23.06.2024 16:44:53] WebUI started. [23.06.2024 16:44:53] Bad response from server: (500 [error,getplugins]) Internal Server Error

On the server the apache2 log reports the following [Sun Jun 23 16:30:26.455606 2024] [php:error] [pid 4135418] [client [redacted]] PHP Fatal error: Uncaught TypeError: array_diff(): Argument #1 ($array) must be of type array, false given in /var/www/ruTorrent-4.3.5/php/utility/fileutil.php:209\nStack trace:\n#0 /var/www/ruTorrent-4.3.5/php/utility/fileutil.php(209): array_diff()\n#1 /var/www/ruTorrent-4.3.5/plugins/_task/task.php(125): FileUtil::deleteDirectory()\n#2 /var/www/ruTorrent-4.3.5/plugins/_task/task.php(370): rTask::clean()\n#3 /var/www/ruTorrent-4.3.5/plugins/_task/init.php(5): rTaskManager::cleanup()\n#4 /var/www/ruTorrent-4.3.5/php/getplugins.php(521): require_once('...')\n#5 {main}\n thrown in /var/www/ruTorrent-4.3.5/php/utility/fileutil.php on line 209, referer: https://[redacted]

Steps to reproduce

On the server, disable the php7.4 apache module, enable the php8.3 module, and restart apache:

` 16:39:26 root /var/www/ruTorrent-4.3.5% a2dismod php7.4 Module php7.4 disabled. To activate the new configuration, you need to run: systemctl restart apache2

16:44:23 root /var/www/ruTorrent-4.3.5% a2enmod php8.3 Considering dependency mpm_prefork for php8.3: Considering conflict mpm_event for mpm_prefork: Considering conflict mpm_worker for mpm_prefork: Module mpm_prefork already enabled Considering conflict php5 for php8.3: Enabling module php8.3. To activate the new configuration, you need to run: systemctl restart apache2

16:44:28 root /var/www/ruTorrent-4.3.5/% systemctl restart apache2 `

Then refresh the client page. The page will fail to refresh, and the error will be written to the log.

Expected behavior

The page should load, and no error should be returned.

Additional context

N/A

stickz commented 2 months ago

This has nothing to do with PHP 8.3. Please ensure that /var/www/ruTorrent-4.3.5/ has proper permissions. The reason for the error is trying to delete a directory, but failing. We can catch this error better, but it's still problematic without proper permissions.

wmarler commented 2 months ago

Ah, my mistake, thanks for the direction. I thought I'd checked & my permissions were because I'd had no errors with php7.4. But I hadn't checked very carefully, and because of your reply I looked closer and found several files/dirs nested in ruTorrent/share/users/ that did not have the correct user/group ownerships. Fixed that, restarted apache, and I'm good to go.