Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Log full of PHP Parse error: .../library/core/class.pluginmanager.php(863)

rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one"NY ✭✭✭

I'm on Vanilla 2.1.11.
The log if full of these lines:

[09-Jul-2015 16:03:51 UTC] PHP Parse error: syntax error, unexpected ';', expecting ']' in /xxxxxx.com/tryvanilla/library/core/class.pluginmanager.php(863) : eval()'d code on line 25

I went to the source of class.pluginmanager.php line 863 and I see the following:

862      if ($PluginInfoString != '')
863           eval($PluginInfoString);

Not being a programmer I went to the PHP online manual and it taught me that the error is actually in the $PluginInfoString.
I have a guess that this means that the error is in one of the many plugins I have (in line25 of one of them???).

I have no idea what's wrong and how to proceed. Dumping $PluginInfoString produces endless number of lines and still doesn't tell me which plugin is bad.

The powers who tasked me with evaluating Vanilla have security and information confidentiality concerns, so I need to clear this out.
I'd appreciate any help, directions that a non-programmer mortal can try;-)

Tagged:

Best Answer

Answers

  • x00x00 MVP
    edited July 2015

    debugging eval is by its nature tricky. One way to find out is to tail the logs and disable plugin then make a request repeat till the log not longer add that error.

    The way pluign info is collected and parsed is by its nature a bit unconventional anyway.

    if you don't understand php you are not going to understand syntax errors, let a lone syntax error as a result of this unconventional way of parsing code.

    If you did output the "PluginInfoString"s I could probably spot it.

    grep is your friend.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Thanks @x00. I'm not following what exactly do I have to do with "tail the logs and disable plugin then make a request repeat". I have no clue what triggers that message, so I don't know what action to repeat... I've got 53 plugins enabled.

    Is there a way to add few statements after the eval statement to check for the error and then dump specific variables (e.g. the line in error, the name of the plugin being processed)?

  • x00x00 MVP
    edited July 2015

    First you can't be sure this a plugin. We will assume this a plugin to start with, but this method is used by locales an themes too. Secondly the plugin class won't actually loaded at this stage, you can't assume it is even enabled. What is happening is it opens the file as text only, not as script. Then attempts to to rip out the PluignInfo array from the text, based on matching rules. So even the code would be syntactically correct, if the fragment it rips out is not syntactically correct when it passed to eval it will error.

    eval is only used in rare circumstances. It is often called "evil" for various reasons, not least debugging it is not straightforward. However it has its use cases.

    In our case we merely need to know were can repeat the error. tailing is a way of reading a file in real time. To make things less technical you can clear your log each time (ensuring it is still writeable), then you can see if the error occurs on a certain request.

    if it is pluign this error should occur when loading /dashboard/settings/plugins

    You can't put anything after the eval becuase the syntax error happens within it. Put before the if statement (if ($PluginInfoString != '')):

    error_log("Current Plugin File: {$PluginFile}\n");
    

    so you will see the file names in the log. Where the parse error occurs it will be the file mentioned before. Go to that file and copy the $PluginInfo array at the top of the file (or copy the whole file) and post it here.

    grep is your friend.

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    That's very clear and useful. I followed your instructions and added the line before the if statement and the error always occurs after the "Registration Message" plugin.

    I went further and looked at the $PluginInfo for that plugin and being a bit curious, I compared it to other plugins. I found that it is a bit different and in a way that explains the log error message.

    The log error message has this segment:

    expecting ']'

    The $PluginInfo for all other plugin start with

      "$PluginInfo['Signatures'] = array(
       'Name' =>", 
    

    but the $PluginInfo for "Registration Message" starts differently.

    Here it is in full as you requested:

        $PluginInfo['registrationmessage'] = [
            'Name' => 'Registration Message',
            'Description' => 'Sends a configurable message to users immediately after registration.',
            'Version' => '0.1',
            'RequiredApplications' => ['Vanilla' => '2.2'],
            'MobileFriendly' => true,
            'SettingsUrl' => 'settings/registrationmessage',
            'SettingsPermission' => 'Garden.Settings.Manage',
            'Author' => 'Bleistivt',
            'AuthorUrl' => 'http://bleistivt.net',
            'License' => 'GNU GPL2'
        ];
    

    I presume this has to be converted to the "array(" format. Correct?

  • rbrahmsonrbrahmson "You may say I'm a dreamer / But I'm not the only one" NY ✭✭✭

    Thanks @Bleistivt,i guess we'll have to wait for 2.2.
    I removed it as recommended.

    And lots of thanks to @x00 who helped me figure out which plugin causes the problems.

Sign In or Register to comment.