Support » Plugin: WooCommerce » parse error

  • Resolved dideto

    (@dideto)


    Hello,
    In my log I see this error
    PHP Parse error: syntax error, unexpected ‘:’, expecting ‘{‘ in /wp-content/plugins/woocommerce/woocommerce.php on line 56

    PHP 7.4
    WP Version: 5.5.3
    WC Version: 4.7.0

    How to fix problem?

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support RK a11n

    (@riaanknoetze)

    Hi there,

    Just to check – Did you recently update to a new version of WooCommerce? have you made any changes to the woocommerce.php file? I’m asking as the line being referenced in your error report has been around for 5 months already 🙂

    See: https://github.com/woocommerce/woocommerce/blame/a5a109ccbeb69e01dde40294d366a9e0915860b6/woocommerce.php#L56

    Thread Starter dideto

    (@dideto)

    Thank you for fast answer.
    This is new instalation. Everything is up to date.
    I never make changes in plugin files.
    Now I open my woocommerce.php and I can see just the same code in line 56 like in github

    Plugin Support RK a11n

    (@riaanknoetze)

    Hmmm, can you share a copy of your status report found under **WooCommerce > Status**? Have you already ruled out conflicts by doing a conflict test?

    Thread Starter dideto

    (@dideto)

    
    ### WordPress Environment ###
    
    WordPress address (URL): https://oak-house-sign.co.uk
    Site address (URL): https://oak-house-sign.co.uk
    WC Version: 4.7.0
    REST API Version: ✔ 4.7.0
    WC Blocks Version: ✔ 3.6.0
    Action Scheduler Version: ✔ 3.1.6
    WC Admin Version: ✔ 1.6.3
    Log Directory Writable: ✔
    WP Version: 5.5.3
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    WP Cron: ✔
    Language: en_US
    External object cache: –
    
    ### Server Environment ###
    
    Server Info: LiteSpeed
    PHP Version: 7.4.9
    PHP Post Max Size: 64 MB
    PHP Time Limit: 300
    PHP Max Input Vars: 3000
    cURL Version: 7.62.0
    OpenSSL/1.0.2k
    
    SUHOSIN Installed: –
    MySQL Version: 5.5.5-10.3.22-MariaDB-log-cll-lve
    Max Upload Size: 64 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 4.7.0
    WC Database Prefix: w_
    Total Database Size: 1.80MB
    Database Data Size: 1.50MB
    Database Index Size: 0.30MB
    wood_woocommerce_sessions: Data: 0.04MB + Index: 0.00MB + Engine MyISAM
    wood_woocommerce_api_keys: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wood_woocommerce_attribute_taxonomies: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_woocommerce_downloadable_product_permissions: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_woocommerce_order_items: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_woocommerce_order_itemmeta: Data: 0.01MB + Index: 0.01MB + Engine MyISAM
    wood_woocommerce_tax_rates: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_woocommerce_tax_rate_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_woocommerce_shipping_zones: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_woocommerce_shipping_zone_locations: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_woocommerce_shipping_zone_methods: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_woocommerce_payment_tokens: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_woocommerce_payment_tokenmeta: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_woocommerce_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_actionscheduler_actions: Data: 0.02MB + Index: 0.02MB + Engine MyISAM
    wood_actionscheduler_claims: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_actionscheduler_groups: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wood_actionscheduler_logs: Data: 0.01MB + Index: 0.01MB + Engine MyISAM
    wood_commentmeta: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_comments: Data: 0.01MB + Index: 0.01MB + Engine MyISAM
    wood_eopa_global_rule_table: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_eopa_poptions_table: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_eopa_rowoption_table: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_eopa_temp_table: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_links: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_litespeed_cssjs: Data: 0.34MB + Index: 0.01MB + Engine MyISAM
    wood_options: Data: 0.74MB + Index: 0.06MB + Engine MyISAM
    wood_postmeta: Data: 0.22MB + Index: 0.05MB + Engine MyISAM
    wood_posts: Data: 0.10MB + Index: 0.02MB + Engine MyISAM
    wood_termmeta: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wood_terms: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wood_term_relationships: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_term_taxonomy: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_usermeta: Data: 0.01MB + Index: 0.01MB + Engine MyISAM
    wood_users: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wood_wc_admin_notes: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_wc_admin_note_actions: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_wc_category_lookup: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_wc_customer_lookup: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wood_wc_download_log: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_wc_order_coupon_lookup: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_wc_order_product_lookup: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wood_wc_order_stats: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wood_wc_order_tax_lookup: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_wc_product_meta_lookup: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wood_wc_reserved_stock: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    wood_wc_tax_rate_classes: Data: 0.00MB + Index: 0.01MB + Engine MyISAM
    wood_wc_webhooks: Data: 0.00MB + Index: 0.00MB + Engine MyISAM
    
    ### Post Type Counts ###
    
    attachment: 45
    custom_css: 1
    et_header_layout: 1
    et_pb_layout: 4
    et_template: 1
    nav_menu_item: 4
    page: 9
    post: 3
    product: 9
    revision: 5
    seedprod: 1
    shop_order: 2
    
    ### Security ###
    
    Secure connection (HTTPS): ✔
    Hide errors from visitors: ✔
    
    ### Active Plugins (7) ###
    
    Coming Soon Page, Maintenance Mode & Landing Pages by SeedProd: by SeedProd – 6.0.9.0
    Cookie Notice: by dFactory – 1.3.2
    LiteSpeed Cache: by LiteSpeed Technologies – 3.5.2
    WooCommerce PayPal Checkout Gateway: by WooCommerce – 2.1.0 – Installed version not tested with active version of WooCommerce 4.7.0
    WooCommerce Stripe Gateway: by WooCommerce – 4.5.5 – Installed version not tested with active version of WooCommerce 4.7.0
    WooCommerce: by Automattic – 4.7.0
    Extendons: WooCommerce Product Add-ons - Custom Product Options Plugin: by Extendons – 3.0.2 – Installed version not tested with active version of WooCommerce 4.7.0
    
    ### Inactive Plugins (0) ###
    
    ### Settings ###
    
    API Enabled: –
    Force SSL: –
    Currency: GBP (£)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    Taxonomies: Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
    exclude-from-search (exclude-from-search)
    featured (featured)
    outofstock (outofstock)
    rated-1 (rated-1)
    rated-2 (rated-2)
    rated-3 (rated-3)
    rated-4 (rated-4)
    rated-5 (rated-5)
    
    Connected to WooCommerce.com: –
    
    ### WC Pages ###
    
    Shop base: #10 - /shop/
    Cart: #11 - /cart/
    Checkout: #12 - /checkout/
    My account: #13 - /my-account/
    Terms and conditions: #218 - /terms-and-conditions/
    
    ### Theme ###
    
    Name: Divi Child Theme
    Version: 0.0.1
    Author URL: http://elegantthemes.com
    Child Theme: ✔
    Parent Theme Name: Divi
    Parent Theme Version: 4.6.0
    Parent Theme Author URL: http://www.elegantthemes.com
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: –
    
    ### Action Scheduler ###
    
    Complete: 63
    Oldest: 2020-10-27 09:41:30 +0000
    Newest: 2020-11-20 07:31:55 +0000
    
    
    Thread Starter dideto

    (@dideto)

    Yes I made conflict test

    Plugin Author peterfabian1000

    (@peterfabian1000)

    Hi @dideto

    I’m just guessing here, but maybe this error comes from earlier when you ran a different version of PHP (PHP 5, most likely).

    Since PHP 7.0 (which was released 5 years ago), the language supports declaring return types for functions, which is what we’re doing on that line in the PHP script.

    My assumption, since you could send us your System Status Report is that currently, WooCommerce runs and works for you, is that correct? Because if you faced a syntax error in the main WooCommerce file and WC was active, you wouldn’t be able to visit any WordPress page on your website.

    Therefore, I think you can ignore this error, unless it appears again.

    Hope it helps!

    Thread Starter dideto

    (@dideto)

    Thank you!
    This is new hosting account, with fresh WP and Woo instalation. So i think problem is not old version from earlier.
    OK I will ignore

    Plugin Author peterfabian1000

    (@peterfabian1000)

    If this is a new hosting account, then I would encourage you to check with your hosting company. You can tell them that you are seeing syntax error messages in the logs for return type declarations in PHP and they should be able to check if everything is in order. We test our code on PHP 7.0 – 8.0 on different environments from Windows to Linux to MacOS and haven’t seen this error yet, so it seems unlikely that it would be a problem with WooCommerce.

    Another option would be that the code was corrupted somehow (e.g. incomplete installation), but since your site works now, I think the syntax error can’t be happening anymore, otherwise, you would just see an error message/blank screen.

    If you find out more, please let us know. Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘parse error’ is closed to new replies.