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.
Comment | File | Size | Author |
---|---|---|---|
#3 | content-use_module_load_include-1442886-3.patch | 403 bytes | pdrake |
#1 | content-use_module_load_include-1442886-1.patch | 439 bytes | pdrake |
Comments
Comment #1
pdrake CreditAttribution: pdrake commentedPatch to change require_once to module_load_include().
Comment #2
pdrake CreditAttribution: pdrake commentedGuess I should have set this to needs review.
Comment #3
pdrake CreditAttribution: pdrake commentedAbove patch removes a line which is still needed. This patch should work better.
Comment #4
catchPatch makes sense.
This was also reported against memcache at #616282: Fatal error opening required theme.inc in content.module.
Comment #5
yched CreditAttribution: yched commentedCommitted. Thanks !
Comment #6
catchI 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.
Comment #8
jvieille CreditAttribution: jvieille commented#3 solved my problem, errors like this once have gone:
This isn't fixed hovwever, need to be ported
Comment #9
ryan.gibson CreditAttribution: ryan.gibson commentedThis applied cleanly for me - isn't this ready to be committed?
Comment #10
jordan8037310 CreditAttribution: jordan8037310 commented#3 worked for me 6.x-2.9
Comment #11
DamienMcKennaThis was already committed to 6.x-2.x.