acctman Posted May 7, 2009 Share Posted May 7, 2009 [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 https://forums.phpfreaks.com/topic/157181-unexpected-t_string-error-but-being-parsed/ Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 Can you post line 315 of parser.php? Link to comment https://forums.phpfreaks.com/topic/157181-unexpected-t_string-error-but-being-parsed/#findComment-828242 Share on other sites More sharing options...
acctman Posted May 7, 2009 Author Share Posted May 7, 2009 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 https://forums.phpfreaks.com/topic/157181-unexpected-t_string-error-but-being-parsed/#findComment-828245 Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 Um... is there a reason you're running evals in that function? Link to comment https://forums.phpfreaks.com/topic/157181-unexpected-t_string-error-but-being-parsed/#findComment-828248 Share on other sites More sharing options...
acctman Posted May 7, 2009 Author Share Posted May 7, 2009 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 https://forums.phpfreaks.com/topic/157181-unexpected-t_string-error-but-being-parsed/#findComment-828256 Share on other sites More sharing options...
Ken2k7 Posted May 7, 2009 Share Posted May 7, 2009 No, eval just evaluates some PHP. Example: eval('$query = "blah";'); echo $query; // prints out blah Link to comment https://forums.phpfreaks.com/topic/157181-unexpected-t_string-error-but-being-parsed/#findComment-828258 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.