Support » Plugin: WooCommerce » Parse error: syntax error, unexpected ‘:’, expecting error is showing

  • Resolved adii123

    (@adii123)


    hi, i have updated the woocommerce to latest version. this error is appearng

    Parse error: syntax error, unexpected ‘:’, expecting ‘{‘ in /public_html/wp-content/plugins/woocommerce/woocommerce.php on line 56

    on this function
    function wc_get_container() : \Psr\Container\ContainerInterface {
    return $GLOBALS[‘wc_container’];
    }

    Please help me inresolving this issue

Viewing 12 replies - 16 through 27 (of 27 total)
  • I’m having simular issue but on the line 57 with both PHP 7.3 and 7.4

    Parse error: syntax error, unexpected ‘:’, expecting ‘{‘ in /public_html/wp-content/plugins/woocommerce/woocommerce.php on line 57

    Reinstalled WooCommerce a few time but it’s still coming up.
    Would realy appreciate if this gets solved.

    I have this parse error on line 57 too. I have spoken to woocommerce several time over the past few months to no avail. I have deactivated plugin, upgraded software, upgraded php and still the problem occurs, my client is now, understandably, getting a little frustrated. Has anyone found an answer to this error?

    also getting this issue… what do we dooo?

    @davidschwartz12

    I updated my php to past version 7.2 and it works. Hope that helps.

    Thank you to whoever suggested upgrading the PHP version! You saved me hours of work. Upgraded to 7.4 and worked.

    I’m running PHP 7.4+ and still having this issue. Is there some configuration in the php.ini file that needs to be tweaked or something? This is breaking a lot of sites. I can’t update past PHP 7.4 right now. But according to this thread, it should be working. Anyone?

    ZAAAX

    (@stevenjram)

    Hi, I’m getting the same error, over and over again, every update to any plugin keeps initiating the same error.

    [16-Jun-2021 23:00:50 UTC] PHP Parse error: syntax error, unexpected ‘:’, expecting ‘{‘ in /home/——/public_html/wp-content/plugins/woocommerce/woocommerce.php on line 57

    We’re running PHP Version 7.4, the “latest” version required by WordPress and WooCommerce.

    Why isn’t WooCommerce fixing this with an update that works?
    Is it a WordPress issue?
    What is the solution here?

    Sooo many people with the same problem deserve some action surely.

    Am experiencing this issue out of nowhere. No changes or recent notifications of any automatic updates to our site. It says the error is occuring at the login page, which means I can’t login to my admin panel. Am running PHP 7.4.20

    I am going to have to use a backup to restore the site and looks like my only option is to somehow deactivate and remove the WooCommerce component that we aren’t even currently using.

    I got this too when trying to use WP-CLI search-replace.
    unexpected ‘:’, expecting ‘{‘ in /public_html/site/wp-content/plugins/woocommerce/woocommerce.php on line 57

    Solutions? Ideas?

    Plugin Support Mirko P. woo-hc

    (@rainfallnixfig)

    Hello @argentum,

    Please create your own thread since this one is technically resolved. We want to make sure that every user’s issues receive their own thread with proper attention.

    Cheers.

    I was getting the same error, I just updated the PHP version in WHM from 5.x to 7.1, and it quickly fixed the issue. Hopefully, it’ll work for you as well unless any other plugin/theme is not causing a conflict.

    Perhaps, I’ll recommend, activating WordPress basic theme temporarily & updating the PHP version. It should tell you what yu’re looking for

    • This reply was modified 5 months, 3 weeks ago by codetoons.
    hargobind

    (@hargobind)

    As other people have found, switching from PHP 5.x to 7.x fixed the issue for me. There was one caveat though…

    In cPanel, you can use the MultiPHP Manager to change the version of PHP that the site runs on. But, if you use WP-CLI, then it will still run on the default system version. So if that default version is still PHP 5.x, you’ll continue to see the error.

    In that case, run this command and it will tell you what version of PHP it’s using.
    wp-cli --info

    Follow either of these links in order to make wp-cli use a different version of PHP:

    https://make.wordpress.org/cli/handbook/installing/#using-a-custom-php-binary

    https://wordpress.stackexchange.com/questions/244164/wp-cli-selecting-php-version

    https://stackoverflow.com/questions/31206864/use-different-php-version-cli-executable-for-one-command

Viewing 12 replies - 16 through 27 (of 27 total)
  • You must be logged in to reply to this topic.