This module crashes the website when the front_page module is installed and the cache support is enabled. This happens when the user logs out of drupal and the cache takes over.

It gives the follow error:

Fatal error: Call to undefined function: t() in /home/minglr/public_html/modules/hof/hof.module on line 178

CommentFileSizeAuthor
#1 hof.module21.21 KBsyscrusher

Comments

syscrusher’s picture

Assigned: Unassigned » syscrusher
Priority: Normal » Critical
StatusFileSize
new21.21 KB

Thanks for reporting the bug. It appears that t() is not yet defined in hook_init() if cache is being used. Since I didn't need the result of that particular call until later anyway, I moved it into the page generation code. I've tested this with anonymous access on my local site, and it works here. Please test, and report back whether this fixes the problem for you.

I haven't committed this to CVS yet, pending your test report.

Note that the attachment is a replacement for hof.module, not just a diff.

Scott

sami_k’s picture

Thanks Scott, great module btw. Now when I replaced the module with your code with the cache disabled I get this:

warning: Cannot modify header information - headers already sent by (output started at /home/site1/public_html/modules/hof/hof.module:465) in /home/site1/public_html/includes/common.inc on line 192.

Regards,
Sami

syscrusher’s picture

Well, the module is only 463 lines long, so if you're getting an error from "line 465", there is an extremely good chance that you accidentally inserted some blank lines after the PHP closing tag ?> at the end. Please check for that, and delete any blank lines you find at the end of the module. Let me know if this doesn't fix the problem. There's definitely something wrong with your copy, because the canonical version here is 463 lines long.

Scott

syscrusher’s picture

GAAAAK! The file I attached to my previous post renders as HTML when you click on it. I'm not sure what I did wrong, but I'll go ahead and commit the update to CVS instead. Don't download the previous version (it's okay to view it, of course). Sorry.

Scott

sami_k’s picture

The CVS doesn't seem to be committed as of yet, it's still giving the error.

syscrusher’s picture

You must have gotten in really quickly -- CVS was updated just a few minutes after my last post, for 4.5, 4.6, and HEAD. Please try again. The indication that you have the right module is seeing _hof_constants() called from inside hof_page().

sami_k’s picture

Two thumbs up, thank you! It works with both cache on and off.

Sami

Anonymous’s picture