I am trying to move from PHP 7.4 to 8, but I got a fatal error message [closed]

Dear stackoverfolow community,

I have received this error code:

Fatal error: Declaration of DatabaseConnection::query($query, array $args = [], $options = []) must be compatible with PDO::query(string $query, ?int $fetchMode = null, mixed …$fetchModeArgs): PDOStatement|false in /usr/www/users/immobitt/drupal7/includes/database/database.inc on line 579

For very specific reasons, which I don’t want to specify here, I would like to stay with Drupal 7. To achieve a PHP upgrade, which also applies to the newer version 8.4, I would only need to correct the error I posted above.

My questions

  • can I publish the relevant file where the changes need to be made (database.inc) here, or send it to anybodody of you guys?

  • If the error (as can be seen) refers to line 579, does that mean that a change would only need to be made there?

  • To get rid of the error, could it be possible to replace “DatabaseConnection::query” with DatabaseConnection::runQuery ?

I apologize that I do not yet have the knowledge to explain it better – I have been trying to publish the code of the relevant file – but not possible –

I would greatly appreciate your support and help.

Best regards to the Stack Overflow community and thank you for your understanding.