Join the Stack Overflow Community
Stack Overflow is a community of 6.5 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I can't figure out where this error is located. Line 1 is <?php also i'm using a phpIDE app and its not showing any errors / missing braces.

PHP Parse error: syntax error, unexpected '(', expecting T_STRING or T_VARIABLE or '{' or '$' in /home/ratemy/public_html/kernel/parser.php(190) : eval()'d code on line 1

code lines from 167 - 200... line 190 is marked below.

# Format replaced vars
    function do_format($value,$s) {
            global $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;
            }

# Execute template block
    function exec_block($start, $end, $jump = -2) {
            $this->tpi = $start - 1;
            while ($this->tpi < $end) {
                    $s = $this->templ_read();
                    $this->s = $this->template_replace_vars($s);
                    if ($this->act[$this->tpi] == 'continue_loop') return false;
                    if ($this->act[$this->tpi] == 'break_loop') {
                            $this->cancel_loop = true;
                            return false;
                            }
                    eval('$this->'.$this->act[$this->tpi].'();'); // LINE 190
                    }
            if ($jump != -2)
                    $this->tpi = $jump;
            }

# Echo a line
    function do_print() {
            echo $this->s;
            }

... snippet

there is more too the file is there a way I can figure out where this error is actually at?

share|improve this question

closed as off-topic by Jocelyn, The_Black_Smurf, Ryan Kempt, Machavity, mpromonet Jun 20 '16 at 18:52

This question appears to be off-topic. The users who voted to close gave these specific reasons:

  • "This question was caused by a problem that can no longer be reproduced or a simple typographical error. While similar questions may be on-topic here, this one was resolved in a manner unlikely to help future readers. This can often be avoided by identifying and closely inspecting the shortest program necessary to reproduce the problem before posting." – Jocelyn, Machavity, mpromonet
  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Complete, and Verifiable example." – The_Black_Smurf, Ryan Kempt
If this question can be reworded to fit the rules in the help center, please edit the question.

3  
It's in line 190, which obviously contains a call to eval() – knittl Jan 11 '12 at 12:21
    
can you post any of the code from /home/ratemy/public_html/kernel/parser.php? – jere Jan 11 '12 at 12:32
    
@knittl i've edited the question to show line 190 – acctman Jan 11 '12 at 16:00
    
@jere see changes above, thanks. – acctman Jan 11 '12 at 16:01
    
did you try removing those () in eval('$this->'.$this->act[$this->tpi].'();');? the error says there's an unexpected parentheses – jere Jan 11 '12 at 16:08
up vote 2 down vote accepted

If you want to call a function the name of which is given by $this->act[$this->tpi], use this:

call_user_func(array($this, $this->act[$this->tpi]));

Don't do eval, it is evil.

share|improve this answer

@knittl wrote : It's in line 190, which obviously contains a call to eval()" 1 min ago

@knittl is correct - The error is on that line in your file. eval()'d code on line 1 means that the error is on the first line of the code that is being eval()'d on line 190 of file parser.php.

Put this on the line before line 190:

echo '$this->'.$this->act[$this->tpi].'();';

And it will show you the code that is being eval'ed that is causing the error.

share|improve this answer
    
I've edited my question to include line 190 – acctman Jan 11 '12 at 16:01
    
The answers still the same - the error is in the code being eval'ed. Not in the code that is calling the eval. – Danack Jan 12 '12 at 0:28

Not the answer you're looking for? Browse other questions tagged or ask your own question.