Categories
PHP

[Laravel+DBAL] Doctrine\DBAL\Driver\PDOStatement contains 3 abstract methods

I though before not to share every error I met during the development I did so far but it’s just facing more often with the same issue so let’s make it documents for others.

I have a Laravel 5.5.* and use the package: Doctrine\DBAL which is on version v2.5.13, it was working fine, it might be until I did some composer upgrade and of course, also my Windows 10 recently update, it gave me something strange whenever I run the dev of this project. Relatively it gave me error once and project no long running with this error:

local.ERROR: Class Doctrine\DBAL\Driver\PDOStatement contains 3 abstract methods and must therefore be declared abstract or implement the remaining methods (Doctrine\DBAL\Driver\Statement::errorInfo, Doctrine\DBAL\Driver\Statement::rowCount, Doctrine\DBAL\Driver\ResultStatement::columnCount) {“exception”:”[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Class Doctrine\\DBAL\\Driver\\PDOStatement contains 3 abstract methods and must therefore be declared abstract or implement the remaining methods (Doctrine\\DBAL\\Driver\\Statement::errorInfo, Doctrine\\DBAL\\Driver\\Statement::rowCount, Doctrine\\DBAL\\Driver\\ResultStatement::columnCount) at <project-location>\\vendor\\doctrine\\dbal\\lib\\Doctrine\\DBAL\\Driver\\PDOStatement.php:28)

My environment:

  • PHP 7.0.23
  • Apache 2.4,27

Here are related discussion on the same errors that might help you go to straight to read (of course, to help saving the time of our developer searching ;)):

  • Issue#2628: Doctrine abstract methods must be declared in Driver
  • Issue#2847: After update the package to 2.6.2, an error occurred!
  • Issue#2848: PDO exception on version 2.6.2

Already tried accordingly for some solutions:

{
    "minimum-stability": "stable",
    "require": {
        "doctrine/dbal": "2.5.13",
        "doctrine/common": "2.7.0"
    }
}

Not working.

I also did try to upgrade the dbal version from 2.5.x to 2.6 but it was stated that my PHP version not support.

Then so what to do?

So my issue above has been corrected by changing the PHP version from 7.0.23 to 7.1.x and then I run: composer upgrade, the project run as normal.

How is my dependency look like:

"doctrine/dbal": "^2.5",

The change as in attachment, so it may help you guys:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.