Fatal error: Class 'MergeQuery_mysql' not found in /home/int/public_html/drupal7.infonoticias.eu/public/includes/database/database.inc on line 721 Fatal error: Class 'MergeQuery_mysql' not found in /home/int/public_html/drupal7.infonoticias.eu/public/includes/database/database.inc on line 721

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

int’s picture

MySQL 5.0.67
PHP 88M
PHP 5.2.6-2ubuntu4
Apache/2

int’s picture

I think that, sometimes work...

Dave Reid’s picture

Status: Active » Postponed (maintainer needs more info)

Can you reproduce the steps to get this error?

int’s picture

Dave Reid’s picture

1. Double check that all the files copied correctly. There should be a file called database.inc inside your drupal/includes/database/mysql folder.
2. Did you change anything before this error started appearing?

c960657’s picture

Status: Needs review » Postponed (maintainer needs more info)

I see this frequently with PHP 5.2.0 on Debian Etch. Apparently the tokenizer gets the following line in includes/database/mysql/query.inc wrong:

    $query = "INSERT $delay INTO {" . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES ';

This is being tokenized like this:

1.  T_VARIABLE                    »$query«
2.  T_WHITESPACE                  » «
3.                                »=«
4.  T_WHITESPACE                  » «
5.                                »"«
6.  T_STRING                      »INSERT«
7.  T_ENCAPSED_AND_WHITESPACE     » «
8.  T_VARIABLE                    »$delay«
9.  T_ENCAPSED_AND_WHITESPACE     » «
10. T_STRING                      »INTO«
11. T_ENCAPSED_AND_WHITESPACE     » «
12.                               »{«
13.                               »"«
14. T_WHITESPACE                  » «
15.                               ».«
16. T_WHITESPACE                  » «
17. T_VARIABLE                    »$this«
18. T_OBJECT_OPERATOR             »->«
19. T_STRING                      »table«
20. T_WHITESPACE                  » «
21.                               ».«
22. T_WHITESPACE                  » «
23. T_CONSTANT_ENCAPSED_STRING    »'} ('«
24. T_WHITESPACE                  » «
25.                               ».«
26. T_WHITESPACE                  » «
27. T_STRING                      »implode«
28.                               »(«
29. T_CONSTANT_ENCAPSED_STRING    »', '«
30.                               »,«
31. T_WHITESPACE                  » «
32. T_VARIABLE                    »$insert_fields«
33.                               »)«
34. T_WHITESPACE                  » «
35.                               ».«
36. T_WHITESPACE                  » «
37. T_CONSTANT_ENCAPSED_STRING    »') VALUES '«
38.                               »;«

I have no experience with the tokenizer, but line 12 looks wrong. This makes _registry_skip_body() consume the rest of the file, so the remaining classes are not properly detected and stored in the registry.

Changing the offending line to this appears to fix the problem:

    $query = 'INSERT ' . $delay . ' INTO {' . $this->table . '} (' . implode(', ', $insert_fields) . ') VALUES ';

The user comments on the manual page for token_get_all() indicates that the tokenizer has some bugs/weirdnesses.

Damien Tournoud’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
603 bytes

On PHP 5.2.4 (Zend Engine v2.2.0), I correctly get:

T_STRING " INTO {"

So it seems that this particular version shipped with Debian Etch is really broken.

PHP lex script hasn't changed that much in the 5.2 branch [1]. The change that fixed this could be [2], which means we will have to require PHP 5.2.3. Here is a patch.

[1] http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_parser.y?view=lo...
[2] http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_parser.y?r1=1.16...

chx’s picture

We can not make Drupal 7 not run on Debian Etch. This is not a solution I can accept. Sure, Lenny shipped today, it wont be another 3-4 years and every Debian user will be upped to it. We shall fix the registry.

int’s picture

Status: Postponed (maintainer needs more info) » Needs review

I said in post #1 that my php version is: php5 5.2.6-2ubuntu4

So the problem is other...

int’s picture

Status: Needs review » Active

Now give-me this error:
Fatal error: Call to undefined function field_attach_load() in /home/int/public_html/drupal7.infonoticias.eu/public/modules/user/user.module on line 218

I commented that line.

    // Attach fields.
    // TODO D7 : not sure the 3rd param ($types) is needed.
    // field_attach_load('user', array($user->uid => $user));  <-- Commented by me

and now works fine..

Damien Tournoud’s picture

@int: please make sure that you reinstalled from scratch. Updates from a development version (7.x) to another is not supported during the development cycle.

int’s picture

I'm testing, and since 3 minutes testing, now give again this error:

Fatal error: Class 'MergeQuery_mysql' not found in /home/int/public_html/drupal7.infonoticias.eu/public/includes/database/database.inc on line 721 Fatal error: Class 'MergeQuery_mysql' not found in /home/int/public_html/drupal7.infonoticias.eu/public/includes/database/database.inc on line 721

I don't change nothing, just navigate in the admin backend..

My system info is:

Linux server2 2.6.24-19-xen #1 SMP Wed Aug 20 21:08:51 UTC 2008 x86_64 GNU/Linux
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.10
PHP Version 5.2.6-2ubuntu4.1
PHP MEM: 88M
Apache 2/ 2.2.9-7ubuntu3
MySQL 5.0.67-0ubuntu6
int’s picture

I will test re-install again from scratch today... wait for info...

int’s picture

It's working fine with the re-install... I don't know that we can't update from 7.x to 7.x

For me you can close this..

chx’s picture

My test slave is

testslave:~# php -v
PHP 5.2.0-8+etch13 (cli) (built: Oct  2 2008 08:26:18)

and it passes the test suite occassionally. So .. what's going on in #6?

c960657’s picture

After a clean install, my {registry} table only contains the following 36 classes:

includes/database/database.inc        DatabaseConnection
includes/database/database.inc        Database
includes/database/database.inc        TransactionsNotSupportedException
includes/database/database.inc        NoActiveTransactionException
includes/database/database.inc        ExplicitTransactionsNotSupportedException
includes/database/database.inc        InvalidMergeQueryException
includes/database/database.inc        DatabaseTransaction
includes/database/database.inc        DatabaseStatementBase
includes/database/log.inc             DatabaseLog
includes/database/mysql/database.inc  DatabaseConnection_mysql
includes/database/mysql/install.inc   DatabaseInstaller_mysql
includes/database/mysql/query.inc     InsertQuery_mysql
includes/database/mysql/schema.inc    DatabaseSchema_mysql
includes/database/pgsql/database.inc  DatabaseConnection_pgsql
includes/database/pgsql/install.inc   DatabaseInstaller_pgsql
includes/database/pgsql/query.inc     InsertQuery_pgsql
includes/database/pgsql/query.inc     UpdateQuery_pgsql
includes/database/pgsql/schema.inc    DatabaseSchema_pgsql
includes/database/prefetch.inc        DatabaseStatementPrefetch
includes/database/query.inc           Query
includes/database/query.inc           InsertQuery
includes/database/query.inc           MergeQuery
includes/database/query.inc           DeleteQuery
includes/database/query.inc           UpdateQuery
includes/database/query.inc           DatabaseCondition
includes/database/schema.inc          DatabaseSchema
includes/database/select.inc          SelectQuery
includes/database/sqlite/database.inc DatabaseConnection_sqlite
includes/database/sqlite/database.inc DatabaseStatement_sqlite
includes/database/sqlite/install.inc  DatabaseInstaller_sqlite
includes/database/sqlite/query.inc    InsertQuery_sqlite
includes/database/sqlite/query.inc    UpdateQuery_sqlite
includes/database/sqlite/query.inc    DeleteQuery_sqlite
includes/database/sqlite/schema.inc   DatabaseSchema_sqlite
includes/install.inc                  DatabaseInstaller
modules/field/field.crud.inc          FieldException

I haven't found a good way to reproduce the MergeQuery_mysql error yet.

c960657’s picture

The code in http://us2.php.net/manual/en/function.php-check-syntax.php#86466 seems able to compensate for this bug. I am not sure how much of it is necessary.

c960657’s picture

Status: Active » Needs review
FileSize
1.1 KB

Workaround for the tokenizer bug. It has been tested with PHP 5.2.0.

c960657’s picture

I have been using the patch on my HEAD checkout for the past weeks, so far without any problems AFAICT.

mgifford’s picture

I just got this error when installing a fresh version of D7 from CVS onto may Mac using MAMP.

I commented that out line out:

PHP Fatal error:  Call to undefined function field_attach_load() in /Applications/MAMP/htdocs/drupal-cvs/modules/user/user.module on line 270

That function is there in modules/node/node.module but is it possible when a new drupal site is being launched that user.module is loaded but node.module isn't loaded yet (no nodes created??)

I gen got

PHP Fatal error:  Call to undefined function field_attach_form() in /Applications/MAMP/htdocs/drupal-cvs/modules/user/user.module on line 394

Which works better, except when going http://localhost:8888/drupal-cvs/?q=user/register which gives me this error now:

PHP Fatal error:  Call to undefined function field_attach_presave() in /Applications/MAMP/htdocs/drupal-cvs/modules/user/user.module on line 397

So somethings amiss here.

Mike

Status: Needs review » Needs work

The last submitted patch failed testing.

c960657’s picture

Status: Needs work » Needs review
FileSize
1.24 KB
chx’s picture

FileSize
666 bytes

This is all good, but a) you used backtick. I use apostrophe instead. b) you used two loops. One is enough.

Status: Needs review » Needs work

The last submitted patch failed testing.

c960657’s picture

Status: Needs work » Needs review
FileSize
2.75 KB

The use of backtick was intentional. AFAICT the error only occurs with strings that are subject to variable substitution, i.e "$y {", `$y {` and HEREDOC strings, but not '$y {'. I changed the while condition to something slightly more readable (I think) and added a test.

chx’s picture

Status: Needs review » Reviewed & tested by the community

I see. Nice job.

Dries’s picture

Status: Reviewed & tested by the community » Fixed

Thanks -- glad to see it come with a test. Committed to CVS HEAD. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Exteris’s picture

Status: Closed (fixed) » Active

Issue still in the latest CVS HEAD (with sqlite3)

Crell’s picture

Status: Active » Closed (fixed)

This is being handled over here: #684138: DatabaseConnection_sqlite->dbNextId() always returns NULL, breaking batch api, installation.

Please don't re-open long-closed issues.