Jump to content

unexpected T_STRING error but being parsed...


acctman

Recommended Posts

[06-May-2009 22:45:58] PHP Parse error:  syntax error, unexpected T_STRING in /kernel/parser.php(315) : eval()'d code on line 4

 

this is the top lines in the parser.php. so from what I can see the problem is in one of my .tpl files in which I have about 50+ is there a why to figure out which file is generating that the T_STRING error without going through all 50+ files scanning for a error?

function class_template($templ) {
        $tpl = new show_template;
        $tpl->$template = $templ;
        $tpl->print_out();
        }

Link to comment
Share on other sites

Can you post line 315 of parser.php?

 

line 315 is return $value; (second to last line at the botton) i posted the function before it as well

function template_array($s) {
global $names, $profs, $ifcn, $if, $iflev, $en, $s, $elsif, $beenelsif, $loops, $loopstart, $loopentry, $loopends, $looparray, $t_id, $curr_tpl, $templ, $tpi;
extract($names);

                $incl = substr($s,strlen('<!--[Array '));

                $arr = substr($incl,0,strpos($incl,' '));

                $incl = substr($incl,strlen($arr)+1);

                $incl = substr($incl,0,strpos($incl,']-->'));



                eval('$query = "'.$incl.'";');

                $result = sql_query($query);

                $temparray = array(); $npk = 0;

                while ($line = sql_fetch_assoc($result))

                       $temparray[++$npk] = $line;

                if (substr($arr,0,1) == '>')  $arr = substr($arr,1);

                $arr = str_replace(chr(92),'',$arr);

                if (!$temparray[1]) $temparray[1] = array();

                eval($arr.' = array_merge('.$arr.',$temparray[1]);');

        return '';
        }

function do_format($value) {
        global $s, $en;
        $value = (isset($en[$value]) ? $en[$value] : @constant($value));
        $i = strtolower($s);
        if (strpos($i,'echo') || strpos($i,'define')) {
                $value = str_replace('"','`',$value);
                $value = str_replace(chr(39),'`',$value);
                }
        return $value;
        }

Link to comment
Share on other sites

Um... is there a reason you're running evals in that function?

 

the parser file wasn't written by me, but from what I'm assuming its being used to make sure any php code written into the .tpl files stay valid. I'm pretty sure I wrote a piece of php code and left out a closing bracket or semicolon. but since its parse the files its hard to know which tpl is giving the error. is there any piece of debug coding i can put into a header file that would output any error codes to a text file? i'm not sure if that would even work though since the errorlog is just giving me the parsed error

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.