FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » Unused template causing compiler error
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Unused template causing compiler error [message #24717] Wed, 11 May 2005 17:38 Go to next message
petej74 is currently offline  petej74   United States
Messages: 5
Registered: January 2005
Karma: 0
Junior Member
Running FUDforum 2.6.12...

Seems that removing all references to the "curtime" template in the default theme caused the template compiler to throw an error.

No source for curtime.tmpl


Poking around in the logic and playing with a theme that still contained curtime references revealed that there may be a logic error here.

If a template like "curtime" that doesn't have a src component is referenced before it is processed, then when resolve_compile() below is called, the file will already exist in the cache and will be ignoed.

If the template isn't referenced, then resolve_compile() below will try to compile it. When it finds that there is no src component (which seems perfectly valid for curtime.tmpl), it exits w/error. Changing the exit() call to a return() call fixed the issue for now without any visible side effects, but maybe I'm misunderstanding something here?

Here's the relevant code from include/compiler.inc...
    593         resolve_compile($file);
    594         if (isset($GLOBALS['file_cache'][$file]['inline'])) {
    595             continue;


    505 function resolve_compile($file)
    506 {
    507     if (isset($GLOBALS['file_cache'][$file])) {
    508         return;
    509     }
    510     resolve_refs($file, $file);
    511     resolve_inc_refs($file);
    512     if (empty($GLOBALS['file_cache'][$file]['src'])) {
    513         exit('No source for '.$file);
    514     }
    515
    516     $GLOBALS['file_cache'][$file]['compiled'] = compile_file($GLOBALS['file_cache'][$file]['src']);
    517 }

[Updated on: Wed, 11 May 2005 17:44]

Report message to a moderator

Re: Unused template causing compiler error [message #24744 is a reply to message #24717] Thu, 12 May 2005 21:45 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Mexico
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
If the template file is unused, it should be removed from the template directory.

FUDforum Core Developer
Re: Unused template causing compiler error [message #24748 is a reply to message #24744] Thu, 12 May 2005 21:52 Go to previous messageGo to next message
petej74 is currently offline  petej74   United States
Messages: 5
Registered: January 2005
Karma: 0
Junior Member
And that's the solution? What if I want to keep the template around in case I use it later? Is that seriously your solution?
Re: Unused template causing compiler error [message #24749 is a reply to message #24748] Thu, 12 May 2005 22:00 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Mexico
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Move it to a different directory, keeping unused template in the "active" directory is a bad idea anyway. You end up wasting processing time pointlessly compiling that template.

As far as the particular fix for this instance of a bug, your solution is not quite right and I will be looking at an alternative when I am back in the office.


FUDforum Core Developer
Re: Unused template causing compiler error [message #24756 is a reply to message #24749] Thu, 12 May 2005 22:16 Go to previous messageGo to next message
petej74 is currently offline  petej74   United States
Messages: 5
Registered: January 2005
Karma: 0
Junior Member
I recognize that my fix isn't the correct fix, I was just pointing out what worked in case it helped find the problem.

As far as the unused template, regardless of whether it should be moved out of the way or not, erroring out on that does seem excessive. But it sounds like you are actually considering this a bug, so I'll stop now.
Re: Unused template causing compiler error [message #24758 is a reply to message #24756] Thu, 12 May 2005 22:20 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Mexico
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Well, the error in this particular area is a BUG... there is no question about that, but you really should remove unused templates.

FUDforum Core Developer
Re: Unused template causing compiler error [message #24815 is a reply to message #24758] Mon, 16 May 2005 14:55 Go to previous message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Fixed in CVS.

Here is the patch:
http://cvs.prohost.org/c/index.cgi/FUDforum/chngview?cn=3530


FUDforum Core Developer
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Exporting messages to NNTP - unusable format
Next Topic: Blank screen when posting to newsgroups
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 18:26:06 GMT 2024

Total time taken to generate the page: 0.02282 seconds