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 15 replies - 1 through 15 (of 27 total)
  • Plugin Support Austin M – a11n

    (@apmwebdev)

    Hi @adii123! I’d be glad to help you with this. Where is this error appearing? Are you still able to get to your dashboard? If so, WooCommerce still showing as active? Is the front end of your site affected at all?

    If you’re able to, can you post your system status report? You can find that by going to WooCommerce > Status in your dashboard, then clicking “Get system report,” then “Copy for support.” That will give me a better idea of what we’re dealing with here.

    I’m getting the very same error message. So I’d very much appreciate it if a resolution could be posted here.

    I did end up resolving the issue (White screen of death(WSOD)) by restoring a backup from the previous day, but I’d still like to know the resolution.

    Thread Starter adii123

    (@adii123)

    this is the link
    http://ahmadbilalcouture.com/

    I can,t login to admin due to this issue that’s why i can,t send system report

    Please help me in resolving this issue. my website is down from 5 days

    thank you

    @adii123 are you able to restore the site using a backup?

    Plugin Support Austin M – a11n

    (@apmwebdev)

    Hi @adii123. Do you have access to your site through some other means? cpanel or FTP or anything like that? If so, I’d recommend going to wp-content/plugins in your site’s home directory and removing the WooCommerce folder completely. If need be, you can get a previous version of the plugin here and upload that to your plugins folder the same way.

    Once you’re able to get access to your site, I’d recommend creating a staging site and testing updates there first going forward.

    With your staging site created, I would try disabling all plugins except for WooCommerce, switching to a default theme like Twenty Twenty, and then trying the update again. Hopefully, it is just the update itself that is broken, and things will work normally once the update is complete.

    I would also like to chime in that I am having the same problem.

    I am upgrading from WooCommerce 4.3.3 to 4.4.1 when I get this problem that creates the error that makes access to the website not possible,

    I have switched to the default Twenty Twenty theme and is still getting the problem. I have since loaded up a backup from my website host cpanel.

    So now my website is functional, but I am not able to update to WooCommerce 4.4.1

    I’m also experiencing issue with this error although it does not stop me getting into WPADMIN, Also it appears intermittent. I have taken the development site back to Woo V4.4.0 to no effect. I’m keen to know as this is appearing on the live site to customers.

    http://www.wizardmodels.ltd

    Update; service side is running PHP version: 5.6.40 and Woo suggest upgrading this to 7.2

    They sent these links on min requirements.

    https://docs.woocommerce.com/document/update-php-wordpress/

    https://docs.woocommerce.com/document/server-requirements/

    Plugin Support Austin M – a11n

    (@apmwebdev)

    Hi all! Were you able to try the update with all plugins disabled and a default theme?

    Update; service side is running PHP version: 5.6.40 and Woo suggest upgrading this to 7.2

    Yes, you should definitely update your PHP version if you’re running an old version of PHP. Did this solve your problem @davercheshire?

    Writing to confirm that updating my PHP to 7.3 (in my case) solved my problem.

    Thanks to all who helped raise this issue.

    Plugin Support Austin M – a11n

    (@apmwebdev)

    Great, I’m glad to hear it! I’ll leave the thread open for a little longer in case other people have the same issue and upgrading their PHP version doesn’t fix the issue, but hopefully that will do it.

    It solved my issue even though I only renamed all woocommerce folders through cpanel.
    Thanks @apmwebdev

    Plugin Support Austin M – a11n

    (@apmwebdev)

    Sure thing! There hasn’t been any movement on this thread in a while, so I’m going to go ahead and mark it as resolved. Feel free to open a new thing with any further questions!

    I’m running PHP 7.4 and WooCommerce 4.6.2 and I still get the issue:

    syntax error, unexpected ':', expecting '{' in plugins/woocommerce/woocommerce.php on line 56

    When Using WP Cli, the error gets also reported:

    php -v

    PHP 7.4.8 (cli) (built: Jul 10 2020 16:20:04) ( NTS )
    Copyright (c) The PHP Group
    Zend Engine v3.4.0, Copyright (c) Zend Technologies
        with Zend OPcache v7.4.8, Copyright (c), by Zend Technologies

    wp –info

    OS:     Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.51-3 (2017-12-13) x86_64
    Shell:  /bin/bash
    PHP binary:     /opt/plesk/php/7.4/bin/php
    PHP version:    7.4.8
    php.ini used:   /opt/plesk/php/7.4/etc/php.ini
    WP-CLI root dir:        phar://wp-cli.phar/vendor/wp-cli/wp-cli
    WP-CLI vendor dir:      phar://wp-cli.phar/vendor
    WP_CLI phar path:       /var/www/vhosts/swiss-qube.ch/httpdocs/swiss-qube.ch/www
    WP-CLI packages dir:
    WP-CLI global config:
    WP-CLI project config:
    WP-CLI version: 2.4.0

    sudo -u swiss-qube wp plugin update –all

    PHP Parse error:  syntax error, unexpected ':', expecting '{' in /var/www/vhosts/swiss-qube.ch/httpdocs/swiss-qube.ch/www/wp-content/plugins/woocommerce/woocommerce.php on line 56
    Parse error: syntax error, unexpected ':', expecting '{' in /var/www/vhosts/swiss-qube.ch/httpdocs/swiss-qube.ch/www/wp-content/plugins/woocommerce/woocommerce.php on line 56
    Error: Es gab einen kritischen Fehler auf Ihrer Website.Erfahren Sie mehr über die Fehlerbehebung in WordPress. Es gab einen kritischen Fehler auf Ihrer Website.

    Website runs fine, but breaks wp-cli, which also using 7.4.8 as you can see. What the hell for a messy new programming way. I know its “new” but hell is it not update friendly.

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