• Resolved gerrelt

    (@gerrelt)


    TL;DR; Plugin update made site unavailable, fixed it by changing empty brackets ( “[]” ) to “array()” at line 560, 594 and 601 in this file:
    plugins/nelio-content/includes/class-nelio-content-auto-sharer.php

    I’ve installed the latest update of the Nelio Content plugin, version 1.3.0 .
    But after installing the update my site didn’t work anymore. My admin site and the normal site where both white.

    I got the site going again by de-activating the Nelio-content plugin via the database (see #2 here).

    When I tried to re-activate the plugin I got this message:

    Parse error: syntax error, unexpected '[' in ..,path to my website.../wp-content/plugins/nelio-content/includes/class-nelio-content-auto-sharer.php on line 560

    I’ve looked in the php file and discovered this at line 560:
    return [];

    Apparently it didn’t like the brackets here. So I did some googling (I am not familiar with PHP), and apparently returning an empty list is done by calling:
    array()

    So I replaced the brackets with that so that it looked like this:
    return array();

    After saving and reactivating the plugin I got the same message but then at line 594, which also contained a line with returning empty brackets. I also changed those bracket by “array()” and reactivated the plugin.
    Again I got the error, but now on line 601.
    There I changed the empty brackets too, but this time it wasn’t a return. After my change it looked like this:
    $tags = array();

    And then reactivating the plugin didn’t gave errors anymore and the plugin worked!
    I use it mainly for “Featured Images”.

    Could it be that this problem has something to do with the PHP version I am using on my site?

    • This topic was modified 6 years, 9 months ago by gerrelt.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter gerrelt

    (@gerrelt)

    Hmmmm…just checked, and my site is running PHP 5.3. Pretty low version.
    I guess that will be the problem?

    I see wordpress requires PHP 7 or higher. I will change it to 7.1, to prevent future problems.

    Thread Starter gerrelt

    (@gerrelt)

    OK, I’ve changed the PHP version to 7.1 and changed the “array()”‘s back to empty brackets, and the plugin is still working!

    Consider this issue solved.

    Plugin Author David Aguilera

    (@davilera)

    Hi @gerrelt,

    Thanks for the heads up and for taking the necessary steps to fix it. Upgrading to PHP 7.1 is a great step forward – afaik, its performance is way better than previous versions.

    That said, I also identified this issue (using square brackets [] for new arrays instead of the classic array() constructor), and I prepared a fix so that the plugin always use the classic version. I’ll release it later on today.

    Thanks again for your detailed feedback!

    Regards,
    David

    Thread Starter gerrelt

    (@gerrelt)

    Hi David,

    Yes, I indeed noticed the performance of my site improved with 7.1.

    Thank you for providing this great plugin!

    Greetings,
    Gerrelt.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Site unavailable after update 1.3.0 : Parse error: unexpected ‘[‘ in …’ is closed to new replies.