Support » Plugin: Jetpack by WordPress.com » Parse error: syntax error, unexpected ‘[‘, expecting ‘)’ – simple-payments.php

  • Resolved arindamg

    (@arindamg)



    I just updated to the latest Jetpack 6.3 updated approx two hours back from now. And it broke my site with below error. I had to disable Jetpack manually via file manager.

    Is it something that recent update broke?

    Anyone is also facing this?

    Parse error: syntax error, unexpected '[', expecting ')' in /xxx/wp-content/plugins/jetpack_disabled/modules/widgets/simple-payments.php on line 220

    I tried to reinstall but while activating I am getting same above error with “Plugin could not be activated because it triggered a fatal error.”

Viewing 15 replies - 1 through 15 (of 46 total)
  • I received a similar error, same file, though different line.

    Fatal Error (E_ERROR): Call to undefined method Jetpack_Simple_Payments::is_enabled_jetpack_simple_payments() occurred in wp-content/plugins/jetpack/modules/widgets/simple-payments.php on line 480 please make sure that your website is accessible

    I didn’t dig into any errors, but I can say Jetpack 6.3 took downevery WordPress site that I host. Deleted the plugins was the only way to get them back.

    Same error – line 220 as with arindamg

    I too tried to reinstall and it refuses to activate for the same reason. Frustraiting that it will check that before activation, but not as part as an automated update/upgrade.

    Replacing [ and ] with { and } worked for me. Of course, the plugin needs a proper update.

    Open the file: plugins/jetpack/modules/widgets/simple-payments.php

    Go to line 220

    CHANGE:

    			wp_send_json_success( [
    				'product_post_id' => $product_post_id,
    				'product_post_title' => $params['post_title'],
    			] );

    TO:

    			wp_send_json_success( {
    				'product_post_id' => $product_post_id,
    				'product_post_title' => $params['post_title'],
    			} );

    Edit: This merely removed the error but the plugin is not getting activated. The plugin needs an update.

    • This reply was modified 4 months, 2 weeks ago by  Vinayy. Reason: Plugin is not throwing the error but it is not getting activated

    Thanks Vinayy. Though I am still getting the syntax error with that change. Interestingly – the change to {}, it produced a syntax error in my editor (as well as in WordPress) whereas the existing [] did not…

    • This reply was modified 4 months, 2 weeks ago by  LeeFallin. Reason: typo

    Hello, I am facing the same error, please help! how to solve this problem?
    My site is downing because of this error….

    Parse error: syntax error, unexpected '[', expecting ')' in /xxx/wp-content/plugins/jetpack_disabled/modules/widgets/simple-payments.php on line 220

    I was trying to update to the latest version today and then this happened.
    Who can help me please??

    Plugin Support Dat Hoang

    (@htdat)

    Hi, thank you all for your reports and we’re sorry for this issue.

    Parse error: syntax error, unexpected ‘[‘, expecting ‘)’ in jetpack/modules/widgets/simple-payments.php on line 220

    Our developers are aware of the issue here https://github.com/Automattic/jetpack/issues/9858

    And we’re working on the solution https://github.com/Automattic/jetpack/pull/9859

    The temporary solution is to install the latest stable version of 6.2.1:

    1. Log in to your site via FTP or File Manager
    2. Delete the existing Jetpack plugin folder in wp-content/plugins/jetpack.
    3. Download the previous stable version of Jetpack 6.2.1 – https://downloads.wordpress.org/plugin/jetpack.6.2.1.zip
    4. Reinstall the plugin manually by following the instructions here: http://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation

    —–

    Fatal Error (E_ERROR): Call to undefined method Jetpack_Simple_Payments::is_enabled_jetpack_simple_payments() occurred in wp-content/plugins/jetpack/modules/widgets/simple-payments.php on line 480 please make sure that your website is accessible

    We’re still investigating this issue.

    • This reply was modified 4 months, 2 weeks ago by  Dat Hoang.

    Parse error: syntax error, unexpected ‘[‘, expecting ‘)’ in /xxx/wp-content/plugins/jetpack_disabled/modules/widgets/simple-payments.php on line 220

    こんにちは、私も更新をしたら同じエラーになりました。大変困っています!急ぎで改良版をお願いします。

    @htdat has the temporary solution.

    If you don’t need the simple-payments option in Jetpack then another temporary fix for this is to go to the directory:

    /wp-content/plugins/jetpack/modules/widgets/

    Create a new directory in there called broken (or anything)

    Move the file:

    simple-payments.php

    To the new directory “broken” that you’ve created.

    All the best,
    Trystan

    So going on from @htdat temporary fix, this is how to do it at the command line:

    cd ./wp-content/plugins

    ls -alh

    (This will list all the plugin directories, make a note of the ‘owner’ of the directories, on mine it says apache apache)
    (So on mine it looks like drwxr-xr-x 16 apache apache 4.0K Jun 8 19:24 jetpack )

    (Double check that you have written this next command absolutely correctly as it deletes the jetpack directory and everything within it)

    rm -Rf jetpack

    wget https://downloads.wordpress.org/plugin/jetpack.6.2.1.zip

    unzip jetpack.6.2.1.zip

    (This is the bit where you need to use the ‘owner’ that you found when you did the ls -alh command earlier. On mine it was apache. Change the apache to whatever the ownership was in your directory for the rest of the plugins.)

    chown -R apache:apache jetpack

    (So now, if you didn’t deactivate the broken jetpack then it will just work and is already activated. Happy days.)

    Hopefully this will help if you have a lot of sites to fix.

    Plugin Support Dat Hoang

    (@htdat)

    Hi,

    Thanks everyone for your comments above.

    We’ve released the point release 6.3.2 fixing this bug https://jetpack.com/2018/07/04/jetpack-6-3-2-simple-payment-fix/

    This point fix addresses a fatal bug affecting all sites using PHP 5.3 and below.

    A side note here: we recommend upgrading your sites to PHP 5.6 or later per this requirement – https://wordpress.org/about/requirements/.

    Most of the hosting providers are supporting PHP 5.6+ nowadays. If you’re not sure how to do this, feel free to reach your hosting provider(s).

    Again, we’re sorry for this error.

    If you manage WordPress sites for others, and are concerned that the user updates to the broken Jetpack, then this is how to skip the broken version so that the update is now available to them:

    Changed the version number in the file:

    /wp-content/plugins/jetpack/jetpack.php to

    Version 6.3.0

    So now WordPress *thinks* that Jetpack is at version 6.3.0 (which is the latest, but broken Jetpack), so an update won’t become available until 6.3.1 onwards.

    I ended up upgrading PHP to 7.2 which fixed this too. I should have done that much sooner really…

    I’m getting the same errors with 6.3.2 using PHP 7.2.7

    removing the simple payments module & widget is the simplest and quickest fix.

    2018/07/04 15:32:01 [error] 923#923: *3201 FastCGI sent in stderr: “PHP message: PHP Fatal error: Uncaught Error: Class ‘Jetpack_Simple_Payments’ not found in /xxxxxxxxxxxxxxxx/wp-content/plugins/jetpack/modules/widgets/simple-payments.php:479

Viewing 15 replies - 1 through 15 (of 46 total)
  • The topic ‘Parse error: syntax error, unexpected ‘[‘, expecting ‘)’ – simple-payments.php’ is closed to new replies.