• We have the latest version of WordPress (4.9), the latest version of all of our themes, and the latest version of all of our plugins, including Widget Logic (5.9.0). Sometime recently, we started seeing lots of the following parse errors (17 on our home page!):

    Parse error: syntax error, unexpected 'show' (T_STRING), expecting ']' in /home/wp_99emjk/danburyshul.org/wp-content/plugins/widget-logic/widget_logic.php(461) : eval()'d code on line 1

    Lines 460 through 467 in widget_logic.php are:

    	try {
    		$show_widget = eval($logic);
    	}
    	catch ( Error $e ) {
    		trigger_error( $e->getMessage(), E_USER_WARNING );
    
    		$show_widget = false;
    	}

    so it’s clear that we have the dreaded PHP syntax error that’s mentioned in the FAQ. I didn’t put together the site, so it’s not clear to me if this site ever worked correctly with Widget Logic in the past while hiding the error messages and the latest version has just started displaying the errors, or if the latest version broke Widget Logic control fields that had previously been working.

    [Edited to add: I’ve tried the wp_reset_query option and every variation of the load logic point without success, although sometimes the number of error messages changes depending on the chosen load logic point.]

    As an example of one of the control fields that is causing an error, we have:

    [feather_share show=”facebook, twitter, youtube”]

    as the Widget Logic control field for the Social Media Feather widget. Does that give anyone any idea why Widget Logic 5.9.0 is complaining? (We’ve disabled Widget Logic for now, since the site is unusable with all of the error messages.)

    Thanks in advance for any insight or suggestions.

    • This topic was modified 7 years, 4 months ago by kennis.koldewyn. Reason: Added more information about attempted fixes

    The page I need help with: [log in to see the link]

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

    (@wpchefgadget)

    Hi kennis.koldewyn,

    Do you mean you put [feather_share show=”facebook, twitter, youtube”] into the logic field? If so, this is not correct b/c the logic field should contain some properly written PHP code in it.

    [ Signature deleted ]

    • This reply was modified 6 years, 7 months ago by Jan Dembowski.
    Thread Starter kennis.koldewyn

    (@kenniskoldewyn)

    Yes, the person who originally created the site apparently put

    [feather_share show="facebook, twitter, youtube"]

    into the Widget Logic control field for the Social Media Feather widget. So what you’re suggesting is that this code never worked, since it’s not valid PHP, even with an earlier version of Widget Logic? Any idea why all visitors to the site are only now seeing parse errors (when Widget Logic is enabled)? I suppose if the site’s use of Widget Logic never worked, then it should be fairly safe to simply disable it, since the site was never getting any use out of it.

    However, as a computer programmer with almost no WordPress experience, I can imagine another scenario: is it possible that the control fields somehow got munged by a WordPress, theme, or plugin update? Is there some way I could look back at earlier versions of what was in the control fields? I’m not sure where to look for earlier revisions, since use of the Widget Logic control fields in this site seems limited to the theme customization (which shows no user interface for exploring earlier revisions), not the site’s regular pages (which do show earlier revisions). BTW, the theme in question appears to be Genesis (version 2.5.3), since that’s showing up between “Forms” and “Appearance” in the site’s admin menu.

    WPChef

    (@wpchefgadget)

    Hi kennis.koldewyn,

    Correct, this code never worked before, since it’s not a valid PHP syntax, even in any earlier versions of Widget Logic. The site visitors are seeing parse errors b/c the plugin tries to execute the code entered into the logic field and throws the errors since the code is invalid. You’re correct, Widget Logic should be safe to disable in this situation. Unfortunately, there is no way to see what was entered in the logic field before.

    [ Signature deleted ]

    • This reply was modified 6 years, 7 months ago by Jan Dembowski.
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Parse error’ is closed to new replies.