PHP Fatal error: Can't use function return value in write context in /path/to/drupal/includes/common.inc(1729) : eval()'d code on line 4

This happens when I change the default theme from my custom theme (zen sub-theme) to Garland or Zen. Doesn't seem to happen when changing to any of the other default themes. Also happens when trying to copy the site to a different server, which is how I first discovered the problem.

I'm using a zen sub-theme on Drupal 6, admin theme is Garland.

This seems to work to get rid of the error (until I switch the theme again):
1) Move all modules out of the sites/all/modules directory.
2) Flush caches with "drush cc all".
3) Can now access drupal again - set default theme back to my original theme.
4) Move modules back to the /modules directory.
5) Flush caches again
6) Site is now accessible with original theme.

I've tried restoring the modules one at a time to see if I could catch it that way... no luck.

How can I narrow down what is causing this?

Comments

john_b’s picture

If by restore you mean move into modules folder, the better approach is to disable all custom and contrib modules and clear caches. If the problem goes away re-enable them, one by one, clear caches, until the problem returns. However, the eval(')d code may suggest that your problem may be related to php in the database. Therefore the first module I would try disabling in this situation is the core php filter module.

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors

clockwood’s picture

Thanks for the response. After a marathon of disabling modules I tracked it down to a function in OM Maximenu.

john_b’s picture

Well done. I know it can be time-consuming but sometimes it is the best way.

They say New Relic software is good for speedy debugging of a Drupal site. It is not free, and I have not yet tried it.

Digit Professionals specialising in Drupal, WordPress & CiviCRM support for publishers in non-profit and related sectors