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;
}
PDO (PHP Data Objects) is an abstraction layer for your database queries and is an awesome alternative to MySQLi, as it supports 12 different database drivers. This is an immense benefit for people and companies that need it.
To prepare and execute a single SQL statement that accepts no input parameters, use the PDO::exec or PDO::query method. Use the PDO::exec method to execute a statement that returns no result set. Use the PDO::query method to execute a statement that returns one or more result sets.
PDO::query() returns a PDOStatement object, or FALSE on failure.
Remove "doctrine/dbal": "^2.10"
from composer.json
Then (and finally) run composer update
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With