I just installed PHP 8 and I have this error appears? How do I fix it?
Fatal error: Declaration of OM\Db::query(string $statement) must be compatible with PDO::query(string $query, ?int $fetchMode = null, mixed ...$fetchModeArgs) in /home/www/includes/OM/Db.php on line 131
My OM/Db.php
public function query(string $statement) =====> line 131
{
$statement = $this->autoPrefixTables($statement);
$args = func_get_args();
if (count($args) > 1) {
$DbStatement = call_user_func_array(array($this, 'parent::query'), $args);
} else {
$DbStatement = parent::query($statement);
}
if ($DbStatement !== false) {
$DbStatement->setQueryCall('query');
$DbStatement->setPDO($this);
}
return $DbStatement;
}
#1 - Remove from composer Json the similar line
"doctrine/dbal": "^2.10",
#2 - Run
composer upgrade
#3 - Run
composer update
#4 - Voila ! The error should be fixed !