WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Causes PHP error

[Resolved] Causes PHP error

  • My PHP error log shows lots of the same error: PHP Parse error: syntax error, unexpected ‘;’ in widget_logic.php(284) : eval()’d code on line 1
    I’ve checked my widget logic code and don’t see a problem, though there could be one.

    —-My Bad. I DID find an extra “(” in one of my widget logic conditions. All is good now.

Viewing 3 replies - 1 through 3 (of 3 total)
  • esmi

    @esmi

    Forum Moderator

    Site url? It’s possible that your site has been hacked.

    I’m having a similar error after the host updated PHP from 5.2.17 to 5.3.21.

    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting ')' in /home/user/public_html/wp-content/plugins/widget-logic/widget_logic.php(284) : eval()'d code on line 1

    I notice that I had my is_page conditionals like this: is_page(’42’)
    I see here that I should not have the apostrophes in there. (Strange that it always worked fine that way, though.

    Anyway, on that link, it’s hard to tell but it looks like there’s a space between the ( and the number, like this: is_page( 42 ) Is that correct, or should it be like this: is_page(42) ?

    OK, I was able to clear the issue. In case it helps anyone else, it turns out the is_page conditional will work with or without apostrophes, and with our without spaces. It wil not, however, work with just one apostrophe! I had one conditional statement like this: is_page(’42)

    The fix is either to add the closing apostrophe or delete the opening one.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Causes PHP error’ is closed to new replies.