From one second to another I receive the follwing Error when I try to open a page in the Drupal Admin (for example for clearing the cache).

Fatal error: Class Drupal\Core\Database\Statement contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Drupal\Core\Database\StatementInterface::fetchObject) in XXXX\core\lib\Drupal\Core\Database\Statement.php on line 21

When I remove the line "implements StatementInterface" than the admin works fine but the Website frontend still doesnt work.. Any idea?

I have no Modules installed. Just the basic drupal 8 standard installtion and I cleare the cache with a database query already but still the same problem.

CommentFileSizeAuthor
#14 Fatal.PNG265.45 KBowenmck
#13 Fatal.PNG213.7 KBowenmck
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mo86 created an issue. See original summary.

cilefen’s picture

I have not seen this on any 8.0.x version, including 8.0.3. Drupal\Core\Database\Statement contains no abstract methods. Where did you obtain Drupal 8.0.3?

mo86’s picture

I downloaded it from this offical site.

So now everything works again. The following happend:

After removing the "implements StatementInterface" line the admin worked again. So still the frontend throwed the follwing error:

Error: Call to undefined method Drupal\Core\Database\Statement::fetchObject() in Drupal\comment\CommentStatistics->read() (line 80 of xxxx\core\modules\comment\src\CommentStatistics.php).

After deactivating the comments module the frontend and admin both worked. Now a few hours and a few new articles later I reactivated the comments module and I also added the StatementInterface implementation back to the Core\Database\Statement.php. Now everything works fine.

Some days you really dont understand whats going on...

daffie’s picture

@mo86: Can you tell what your memory limit is for php? I have seen these kind of errors and they can come from a lack of available memory.

jelo’s picture

This just happened on a number of my dev sites after upgrading to Drupal 7.50. Affected modules/core vary, e.g.
Fatal error: Class SystemQueue contains 4 abstract methods and must therefore be declared abstract or implement the remaining methods

cilefen’s picture

Have you checked your memory limit and did you delete core/ and vendor/ during the upgrade (you should)?

jelo’s picture

Memory limit is 560MB. I am in D7 so I am not sure what you mean by core/ and vendor/. I did indeed copy all files over the existing files. In another thread I read that sometimes these errors could be caused by opcode caches or memcaches. As it turns out, during the first few minutes I got WSOD on every couple of pageloads. After an hour or so I am unable to reproduce the issues, i.e. it seems to have been some temporary transition after the upgrade.

cilefen’s picture

I am in D7 so I am not sure what you mean by core/ and vendor/. I did indeed copy all files over the existing files.

Sorry, somebody opened this as a D8 issue.

cilefen’s picture

@jelo Certain opcode caches can sometimes hang onto replaced code, even if configured properly.

jelo’s picture

The reason why I replied here is because I figured it might have been some backported feature from D8 to D7.50, but if the opcode cache might explain this then there may not be an issue at all...

cilefen’s picture

Status: Active » Closed (cannot reproduce)

ok

khaldoon_masud’s picture

I was getting this error when i used hook_preprocess_node hook in one of my modules. hope it helps.

owenmck’s picture

FileSize
213.7 KB

I just reproduced this error in XAMPP setup.
Open the admin page /admin/config/system/cron
Run Drupal cron via Windows task scheduler
refresh the admin page.

( ! ) Fatal error: Class Drupal\Core\Database\Statement contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (Drupal\Core\Database\StatementInterface::fetchObject) in C:\xampp\htdocs\MYSITE\core\lib\Drupal\Core\Database\Statement.php on line 16
Call Stack
#	Time	Memory	Function	Location
1	0.0008	356432	{main}( )	...\index.php:0
2	0.0142	384040	Drupal\Core\DrupalKernel->handle( )	...\index.php:19
3	0.0194	462712	Drupal\Core\DrupalKernel->boot( )	...\DrupalKernel.php:655
4	0.0234	469424	Drupal\Core\DrupalKernel->initializeContainer( )	...\DrupalKernel.php:465
5	0.0234	469424	Drupal\Core\DrupalKernel->getCachedContainerDefinition( )	...\DrupalKernel.php:867
6	0.0234	469424	Drupal\Component\DependencyInjection\Container->get( )	...\DrupalKernel.php:512
7	0.0234	469648	Drupal\Component\DependencyInjection\PhpArrayContainer->createService( )	...\Container.php:177
8	0.0235	469648	Drupal\Component\DependencyInjection\PhpArrayContainer->resolveServicesAndParameters( )	...\PhpArrayContainer.php:62
9	0.0235	469680	Drupal\Component\DependencyInjection\Container->get( )	...\PhpArrayContainer.php:264
10	0.0236	469680	Drupal\Component\DependencyInjection\PhpArrayContainer->createService( )	...\Container.php:177
11	0.0237	469680	call_user_func_array:{C:\xampp\htdocs\MYSITE\core\lib\Drupal\Component\DependencyInjection\PhpArrayContainer.php:79} ( )	...\PhpArrayContainer.php:79
12	0.0237	469968	Drupal\Core\Database\Database::getConnection( )	...\PhpArrayContainer.php:79
13	0.0237	469968	Drupal\Core\Database\Database::openConnection( )	...\Database.php:166
14	0.0272	493496	Drupal\Core\Database\Driver\mysql\Connection->__construct( )	...\Database.php:377
15	0.0272	493496	Drupal\Core\Database\Connection->__construct( )	...\Connection.php:71
16	0.0273	494712	setAttribute ( )	...\Connection.php:174
17	0.0273	494760	spl_autoload_call ( )	...\Connection.php:174
18	0.0273	494872	Composer\Autoload\ClassLoader->loadClass( )	...\Connection.php:174
19	0.0276	494984	Composer\Autoload\includeFile( )	...\ClassLoader.php:322
20	0.0277	495856	include( 'C:\xampp\htdocs\MYSITE\core\lib\Drupal\Core\Database\Statement.php' )	...\ClassLoader.php:444

Also, now appears on the status report page: /admin/reports/status

owenmck’s picture

FileSize
265.45 KB
owenmck’s picture

This happened on my localhost scratchpad, running Drupal 8.3.7.
I then got my site back by clearing all the caches manually, stopping MySQL & Apache then restarting them.

TRUNCATE cache_config;
TRUNCATE cache_container;
TRUNCATE cache_data;
TRUNCATE cache_default;
TRUNCATE cache_discovery;
TRUNCATE cache_dynamic_page_cache;
TRUNCATE cache_entity;
TRUNCATE cache_menu;
TRUNCATE cache_render;
TRUNCATE cache_toolbar;
flyke’s picture

What @owenmck said worked for me as well.
So if you have this problem:
- empty every table starting with cache_
- restart your mamp or xamp or whatever

cizario’s picture

hi there,
i've got that fatal error with drupal 8.6.0. i simply restarted my Apache server and the issue is resolved with no effort.
sometimes, strange behavior need 'system' reboot.
i've got the idea cause i was working on LARAVEL project and i encountered similar error. Laravel and Drupal 8 are both using Symfony components and sometimes you have to digg deeper.
hope this can help someone else.

cilefen’s picture

@cizario This is likely caused by the PHP opcache configuration on the web server.

MegaChriz’s picture

I'm also experiencing this issue quite often with Acquia Dev Desktop using PHP 7.0.14 on Mac OS X 10.11. Sometimes it happens multiple times a day. It never occurred using PHP 5. In my case it cannot be caused by opcache, since that extension is disabled. Restarting Apache always helps, but for a limited time only.

The issue isn't limited to Drupal however. It seems PHP loses parts of PDO from time to time. Maybe a memory issue in PHP that only occurs with certain configurations? Cause it happens only on my local machine and not on the webhosting server. I have set the memory limit to 512 MB.

It happens outside of Drupal too:
https://github.com/doctrine/dbal/issues/2628
https://bugs.php.net/bug.php?id=72112
https://stackoverflow.com/questions/42503240/intermittent-php-abstract-c...
https://stackoverflow.com/questions/45051541/class-ci-session-files-driv...

g089h515r806’s picture

same issue with xampp.

MegaChriz’s picture

Fyi, I haven't had this error for a quite a while. I did upgrade to PHP 7.1.29 in the mean time, so I'm assuming the bug is somewhere between PHP 7.0.14 and PHP 7.1.29.

FinderFees’s picture

Chriz, you said you hadn't had the error in quite a while. Did you find a work-around for this bug for 7.0.14? I'm on 7.1.29 and currently experiencing this but won't be able to update for, at minimum, a couple of weeks. Just wondering if there is a band-aid I can put in place until being able to update to 7.2.

mfrosch’s picture

I did a reboot on windows (xampp) and the problem was gone