[Bug]: NC 24.0.8 - PHP8.1 : Return type of OCA\Files_Antivirus\Db\Rule::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed #258
Error: Return type of OCA\Files_Antivirus\Db\Rule::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice at /var/www/html/nextcloud/apps/files_antivirus/lib/Db/Rule.php#84
/var/www/html/nextcloud/apps/files_antivirus/lib/Db/Rule.php - line 27:
OC\Log\ErrorHandler::onError(8192, "Return type ... e", "/var/www/ht ... p", 84)
/var/www/html/nextcloud/lib/composer/composer/ClassLoader.php - line 571:
include("/var/www/ht ... p")
/var/www/html/nextcloud/lib/composer/composer/ClassLoader.php - line 428:
⚠️ This issue respects the following points: ⚠️
Bug description
The following error is displayed in my log:
Error: Return type of OCA\Files_Antivirus\Db\Rule::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice at /var/www/html/nextcloud/apps/files_antivirus/lib/Db/Rule.php#84 /var/www/html/nextcloud/apps/files_antivirus/lib/Db/Rule.php - line 27:
OC\Log\ErrorHandler::onError(8192, "Return type ... e", "/var/www/ht ... p", 84)
/var/www/html/nextcloud/lib/composer/composer/ClassLoader.php - line 571:
include("/var/www/ht ... p")
/var/www/html/nextcloud/lib/composer/composer/ClassLoader.php - line 428:
Composer\Autoload\includeFile("/var/www/ht ... p")
/var/www/html/nextcloud/apps/files_antivirus/lib/Db/RuleMapper.php - line 83:
Composer\Autoload\ClassLoader->loadClass("OCA\Files_ ... e")
/var/www/html/nextcloud/apps/files_antivirus/lib/Status.php - line 141:
OCA\Files_Antivirus\Db\RuleMapper->findAllMatchedByStatus(1)
/var/www/html/nextcloud/apps/files_antivirus/lib/Status.php - line 85:
OCA\Files_Antivirus\Status->getResponseRules()
/var/www/html/nextcloud/apps/files_antivirus/lib/Scanner/ExternalClam.php - line 72:
OCA\Files_Antivirus\Status->parseResponse("stream: OK\n")
/var/www/html/nextcloud/apps/files_antivirus/lib/Scanner/ScannerBase.php - line 108:
OCA\Files_Antivirus\Scanner\ExternalClam->shutdownScanner()
/var/www/html/nextcloud/apps/files_antivirus/lib/Controller/SettingsController.php - line 69:
OCA\Files_Antivirus\Scanner\ScannerBase->scanString("dummy scan content")
/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 225:
OCA\Files_Antivirus\Controller\SettingsController->save("socket", "/var/run/cl ... k", "", 0, "", "/usr/bin/clamscan", "only_log", "26214400", -1)
/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 133:
OC\AppFramework\Http\Dispatcher->executeController(OCA\Files_An ... {}, "save")
/var/www/html/nextcloud/lib/private/AppFramework/App.php - line 172:
OC\AppFramework\Http\Dispatcher->dispatch(OCA\Files_An ... {}, "save")
/var/www/html/nextcloud/lib/private/Route/Router.php - line 298:
OC\AppFramework\App::main("OCA\Files_ ... r", "save", OC\AppFramew ... {}, [ "files_ant ... "])
/var/www/html/nextcloud/lib/base.php - line 1030:
OC\Route\Router->match("/apps/files ... e")
/var/www/html/nextcloud/index.php - line 36:
OC::handleRequest()
Steps to reproduce
Expected behavior
The error message should not occur. Optimize the files, where JsonSerialize::jsonSerialize is used:
With the next update of PHP (8.1) the JsonSerialize::jsonSerialize method will now have this signature:
public function jsonSerialize(): mixed;
Installation method
None
Operating system
RHEL/CentOS
PHP engine version
PHP 8.1
Web server
Apache (supported)
Database engine version
MySQL
Is this bug present after an update or on a fresh install?
Updated to a major version (ex. 22.2.3 to 23.0.1)
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
No response
Additional info
No response