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.
- The character within quotes is "EOT" (end of transmission), which looks empty in the error message.
- 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
Comment #1
christyjohn commentedYes, 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.
Comment #2
dimitriseng commentedI 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.
Comment #3
chytech commentedYes I restarted my apache server as advised above and i got it resolved. Many thanks guys.