I am not 100% this is actually a Drupal bug, but it did occur unexpectedly to me and at least one other person (as reported here: http://drupal.stackexchange.com/questions/15586/fatal-error-cannot-decla...). I don't believe I was doing anything notable at the moment it started happening, and the same codebase (under version control) continued working on another server.

Fatal error: Cannot declare self-referencing constant '' in [drupalroot]\includes\database\database.inc on line 2101

In both cases it happens to have occurred with Drupal 7.9 on Windows systems - mine was XP running XAMPPlite 1.7.3 with Apache 2.2.14, PHP 5.3.1 and pdo_mysql 5.1.41. I am not sure if this is relevant.

  1. The character within quotes is "EOT" (end of transmission), which looks empty in the error message.
  2. Line 2101 in database.inc is the start of the DatabaseStatementBase class.

The error appears to occur prior to even loading the database (though I forgot to test if it still occurred if I stopped mysql entirely), since I tried restarting mysql, dropping the db, recreating the db as empty and adding the user/privileges, then re-importing the db, with no change in any case.

The only fix that worked for me turned out to be simple: restart Apache.

Comments

christyjohn’s picture

Yes, I do confirm it. It happened to me too. I too am working on a Windows XP machine running XAMPP server. Only fix was restarting the Apache Server. Not even removing cache from the database helped.

dimitriseng’s picture

Version: 7.9 » 7.12

I also got the same error on D7.12 on Windows XP using XAMPP and a restart of Apache resolved it. In my case, this happened when I pressed the edit button to modify the "crop and resize" settings but I am not sure if this was actually the real reason. In D7.12 the error was on line 2105 of \includes\database\database.inc.

chytech’s picture

Yes I restarted my apache server as advised above and i got it resolved. Many thanks guys.

Version: 7.12 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.