My Smarty is not compiling (make a pun here)

Update. So I figured this one out. Turns out it was working in 4 and not 5. Remember, kids:

$roscoe = new HoundDog();
$otherdog = $roscoe;

works in PHP4 but for PHP5, one must

$otherdog = clone $roscoe;

So what was happening was, someone was changing rdelim and ldelim somewhere, and under 5 it was failing because the copied object was inheriting the munged r/ldelim; so all parsing failed.

***
Google has failed me.

I have a large, non-trivial application that makes extensive use of Smarty. Now, I know I’m not supposed to be using Smarty any more, but that’s not an option, here. (If it makes you feel any better, it’s on the TODO list.)

What’s happening is, calling a page returns the unparsed output.

This is ordinarily uninteresting, except that if I manually run around including all the parts of the application I get parsed (correct) output. (Mostly, I don’t know that I had the entire shebang working, but I can get output).n

More interesting, the application in question ships with its own Smarty (it’s not using anything on the system) and works great on Linux. Using the same versions (as close as possible anyway) on Mac OS X results in the fucked-up output.

We kinda need to be able to run said app on Mac OS X. Since it’s our dev platform and all. Our deployment platform is Linux. FWIW it fails in both PHP4 and PHP5.

If you’re curious, it fails here:

$search = “~{$ldq}\*(.*?)\*{$rdq}|{$ldq}\s*literal\s*{$rdq}(.*?){$ldq}\s*/literal\s*{$rdq}|{$ldq}\s*php\s*{$rdq}(.*?){$ldq}\s*/php\s*{$rdq}~s”;
preg_match_all($search, $source_content, $match, PREG_SET_ORDER);

(this is around line 257 of Smarty_Compiler.class.php)
$source_content never matches anything, ever, and so it becomes one giant pass-through; _compile_tag() is never called, because the above match fails (and the one right below it that finds the tags to compile). but paste that code and the source, and it finds it perfectly.

I can compile the templates anywhere but within my application (ie, I can write my own smarty thingee and get something compiled).

My google-fu has failed me, because everything always comes back as some tard can’t get his templates to compile because he can’t write to his stupid compile dir or even include the class. I wish it was that simple.

No Comment

No comments yet

Leave a reply

You must be logged in to post a comment.