Support » Plugin: EWWW Image Optimizer » Uncaught Error: syntax error, unexpected ‘)’

  • Resolved Gabriel Kanev

    (@mrgkanev)


    Hi, after update to the newest version of the plugin I got this error:

    Fatal error: Uncaught Error: syntax error, unexpected ')'
    in ../plugins/ewww-image-optimizer/bulk.php on line 343
    
    Call stack:
    
    ewww_image_optimizer_admin_init()
    wp-includes/class-wp-hook.php:292
    WP_Hook::apply_filters()
    wp-includes/class-wp-hook.php:316
    WP_Hook::do_action()
    wp-includes/plugin.php:484
    do_action()
    wp-admin/admin.php:175
    require_once()
    wp-admin/plugins.php:10

    It causes the Admin panel to stop working.

Viewing 11 replies - 1 through 11 (of 11 total)
  • wpblogwriter

    (@wpblogwriter)

    I’ve got the same error updating via WP CLI…

    pierreripka

    (@pierreripka)

    Same issue on multiple sites.

    Seagull87

    (@flagship890)

    Also seeing this… Potentially a stray comma on line 342 and 349 of bulk.php?

    • This reply was modified 3 months ago by Seagull87.
    deswegen

    (@deswegen)

    Same here…

    makkabi

    (@makkabi)

    There are two trailing commas on line 342 and 349, but this syntax is only allowed from PHP 7.3 on. So a quick fix is updating PHP (a good idea anyway!), or deleting the comma on the end of these two lines.

    • This reply was modified 3 months ago by makkabi.
    pierreripka

    (@pierreripka)

    I can confirm, the sites with a PHP version older than 7.3 are the only ones affected.

    wpblogwriter

    (@wpblogwriter)

    @makkabi: my sites affected are running with PHP 7.4. So it is probably not a syntax issue due to too old PHP version..

    makkabi

    (@makkabi)

    @wpblogwriter Maybe you have another issue or some weird PHP settings, maybe double check if PHP 7.3+ is running, because this error is definitely as described.

    A Requires PHP in the plugin’s header would have prevented this. Could the developers add it please ?

    Plugin Author nosilver4u

    (@nosilver4u)

    Checking on this, we don’t intend to require PHP 7.3+ yet, but I use 7.4 for development, so the stray commas don’t always pop up in my testing.
    Will have a bugfix out ASAP.

    Plugin Author nosilver4u

    (@nosilver4u)

    As others have noted, the issue could be fixed by upgrading to PHP 7.3+. That’s a good idea in any case, because all other versions of PHP are EOL (end of life).

    However, I do not intend to drop support for PHP 7.1 and 7.2 at this time, so a fix has been released as version 6.1.7.

    In addition, I found that the error bypassed our automated tests because bulk.php is only included by the admin_init hook, which is not triggered by PHPUnit. I added a unit test to specifically call our admin_init function, so that such errors will be automatically detected pre-release in the future 🙂

    P.S. Note that EOL does not mean 7.1 & 7.2 are completely unsupported, as they may receive security updates from vendors. But it does mean the PHP team will not issue any security updates for those versions, and that your site is running slower than it could be: https://kinsta.com/blog/php-benchmarks/

Viewing 11 replies - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.