The Symptom

Warning: include_once(sites/all/themes/essexdfa2/template.php): failed to open stream: No such file or directory in mailsystem_theme_theme_registry_alter() (line 45 of /home/essexdfa/public_html/sites/all/modules/mailsystem/mailsystem.theme.inc).
Warning: include_once(): Failed opening 'sites/all/themes/essexdfa2/template.php' for inclusion (include_path='.:/usr/share/php:/usr/share/pear') in mailsystem_theme_theme_registry_alter() (line 45 of /home/essexdfa/public_html/sites/all/modules/mailsystem/mailsystem.theme.inc).

What's Happening

When the mailsystem theme is not the same as the currently active theme - for instance if 1) you have a special theme created for mail, or 2) you're on an administration page and the administration theme is different than the default theme - mailsystem attempts to load all of its theme's preprocess code, by calling include_once() for each template.php in the theme's set of base themes.

The problem is that there are some base themes (Fusion is one example, which I happened to be using) that by default do not provide any template.php for their subthemes - at least out-of-the-box the subtheme refers back to the base theme for its preprocess functions. Mailsystem assumes, however, that there is a template.php in its theme directory and calls include_once() without checking first to see if template.php exists, causing an E_Warning to be generated.

Suggested solution:

Wrap the include_once() calls for template.php - both for the mailsystem theme and each of its (possible) base themes) - with a call to file_exists() or is_readable().

Files: 
CommentFileSizeAuthor
#1 mailsystem-1484340-1.patch950 bytesjmarkel

Comments

Version:7.x-2.23» 7.x-2.33
StatusFileSize
new950 bytes

Here's a patch that works for me. It's against 7.x-2.33.

Status:Active» Needs review

Thanks very much for the report and patch. Will review and apply ASAP.

Version:7.x-2.33» 7.x-2.34
Priority:Normal» Major
Status:Needs review» Patch (to be ported)

This bug still exists in 2.34 and the patch still fixes it. I'm using my own fusion sub-theme and suffering from the same bug. Have tested this patch and it works fine. Could we merge it with the main branch?

Many thanks in advance

I knew I missed something in that last release.

Status:Patch (to be ported)» Needs work

Started working on this; realized that the underlyingi function (the one you are patching) is broken. It should be caling system_find_base_themes() intead of parsing the theme data directly.

Don't have any more time today; will try to continue tomorrow.

Thanks - much appreciated & thanks for all the great work

Does mailsystem successfully send email using the custom theme without a template.php file, other than throwing the error?

I'm trying to find an error in my configuration. #1823270: 404 Error

Creating a blank template.php prevents the error from showing up at least.

I'm a designer working on a MAC so patching didn't work out for me so far! but creating an empty template.php as a work around like suggested in #9... Now you're talking!

Patch in #1 resolves for me too.