When theme() is called from within a shutdown function, such as within syslog_watchdog, if the theme registry has been cleared, the following error will be generated:

PHP Fatal error: require_once() [function.require]: Failed opening required './sites/all/modules/contrib/cck/theme/theme.inc' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/sites/all/modules/contrib/cck/content.module on line 176

This occurs because the current directory is no longer the Drupal root directory and the include occurs via a relative path. The patch below modifies content.inc to use module_load_include() instead of require_once. This, in conjunction with the DRUPAL_ROOT backport for D6 (http://drupal.org/node/1345402) solves this fatal error by including the file using an absolute path.

Comments

Patch to change require_once to module_load_include().

Status:Active» Needs review

Guess I should have set this to needs review.

Above patch removes a line which is still needed. This patch should work better.

Patch makes sense.

This was also reported against memcache at #616282: Fatal error opening required theme.inc in content.module.

Committed. Thanks !

Status:Needs review» Fixed

I think the patch is fine, but since it won't fix the issue without the DRUPAL_ROOT backport (which is neither in core nor Pressflow) it's not actually going to remove the error afaik.

In case anyone runs into this in the same way I did, the fault mostly lies with syslog module calling theme(). What happens is that you get a PHP error during shutdown, this calls syslog, syslog calls theme(), theme() tries to get the theme registry, all hell breaks loose because relative file includes are broken during PHP shutdown.

The patch for that is at #659784: (D6 backport) syslog_watchdog() using theme().

Marking this fixed.

Status:Fixed» Closed (fixed)

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

Status:Closed (fixed)» Reviewed & tested by the community

#3 solved my problem, errors like this once have gone:

Warning: require_once(./sites/all/modules/cck/theme/theme.inc) [function.require-once]: failed to open stream: No such file or directory in ...l/sites/all/modules/cck/content.module on line 176

This isn't fixed hovwever, need to be ported

This applied cleanly for me - isn't this ready to be committed?