Circlepuller / Tinyboard

Tinyboard is a light-weight, fast, highly configurable and user-friendly imageboard software package released under a non-restrictive open-source license. It is written in PHP and has few dependencies.
https://awsumchan.org
Other
10 stars 0 forks source link

PHP Error in /ban-appeals #14

Open perdedora opened 2 years ago

perdedora commented 2 years ago

When trying to access ban-appeals with the config:

$config['ban_appeals'] = true;
$config['ban_show_post'] = true;

I get the following error message:

Caught fatal error: Uncaught TypeError: json_decode(): Argument # 1 ($json) must be of type string, array given in /var/www/Tinyboard/inc/display.php:365Stack trace:# 0 /var/www/Tinyboard/inc/display.php(365): json_decode()# 1 /var/www/Tinyboard/inc/mod/pages.php(1020): Thread->__construct()# 2 /var/www/Tinyboard/mod.php(195): mod_ban_appeals()# 3 {main} thrown in /var/www/Tinyboard/inc/display.php on line 365

Edit: this is with php8.0

perdedora commented 2 years ago

Update: this does not happen on php7.4

perdedora commented 2 years ago

I think this has to do it with recent changes in @ operator. From php 8.0 changelog:

The @ operator no longer silences fatal errors.
perdedora commented 2 years ago

This can be solved with:

if (isset($this->files) && $this->files)
            $this->files = is_string($this->files) ? json_decode($this->files) : $this->files;

in https://github.com/Circlepuller/Tinyboard/blob/b8f061816edae1c560859d9ea6b90515542a6f17/inc/display.php#L365 and https://github.com/Circlepuller/Tinyboard/blob/b8f061816edae1c560859d9ea6b90515542a6f17/inc/display.php#L315