• Resolved JeanPaulH

    (@djr)


    Unfortunately I’m unable to activate the plugin. WordPress is throwing a fatal error and my PHP error.log is reporting:

    [09-Nov-2020 17:30:38 UTC] PHP Parse error:  syntax error, unexpected ')' in example.com/wp-content/plugins/draft-concluder/inc/setup.php on line 29
    [09-Nov-2020 17:30:38 UTC] PHP Parse error:  syntax error, unexpected ')' in example.com/wp-content/plugins/draft-concluder/inc/setup.php on line 29
    

    I have very quickly glanced the code (the array_merge statement) but couldn’t see myself why the parentheses is unexpected. My editor is correctly folding all blocks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter JeanPaulH

    (@djr)

    5 mins later … solved when I remove the last comma on line 28.
    I am on PHP 7.2.33 (Mamp Pro) fwiw.

    Plugin Author David Artiss

    (@dartiss)

    Great spot. I think that’s the fasted from release to first bug report that I’ve come across ??

    I’m running 7.4 myself and can’t recreate this myself but, you’re right, that comma shouldn’t be there. I’ll push out an update shortly to fix this.

    Thank you.

    Thread Starter JeanPaulH

    (@djr)

    np. Great idea indeed. I’ll submit some issues on your Github repo (if not already open).

    Plugin Author David Artiss

    (@dartiss)

    Thank you – that would be fantastic. I already have some ideas on there for the next big release, so the more you can add, the better.

    John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    In case you’re wondering, this is because trailing commas in function calls are allowed since PHP 7.3, which is why it works in 7.4 but fatals in 7.2. Info: https://laravel-news.com/php-trailing-commas-functions

    The PHPCompatibility library has saved me from this sort of thing a few times: https://github.com/PHPCompatibility/PHPCompatibility

    Plugin Author David Artiss

    (@dartiss)

    :TIL:

    Thanks John – will dig into that further.

    I can actually drop my PHP version back too, so I’ll make sure I do that when testing in future.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Unable to activate plugin: PHP error’ is closed to new replies.