• Resolved 0815martin

    (@0815martin)


    I get this error since mid of May:
    PHP Parse error: syntax error, unexpected ‘?’, expecting variable (T_VARIABLE) in /home/www/<DOMAIN>/WordPress/wp-content/plugins/woocommerce/vendor/symfony/polyfill-php80/bootstrap.php on line 29

    The PHP version on the server is 7.4

    I tried to fix it by deleting the bold and italic questionmarks in the code below:

    function str_contains(?string $haystack, ?string $needle): bool { return p\Php80::str_contains($haystack ?? ”, $needle ?? ”); }

    function str_ends_with(?string $haystack, ?string $needle): bool { return p\Php80::str_ends_with($haystack ?? ”, $needle ?? ”); }

    That helped with this individual error but then a next error showed up:
    PHP Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in /home/www/<DOMAIN>/WordPress/wp-content/plugins/woocommerce/src/Internal/DependencyManagement/Definition.php on line 18

    I did not try to fix this one.

    What should I do here?
    (Switching to PHP 8.0 does not work for my site for unknown reason)

    The system status report does not tell any errors

    Martin

    • This topic was modified 2 years, 5 months ago by 0815martin.
    • This topic was modified 2 years, 5 months ago by 0815martin.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter 0815martin

    (@0815martin)

    The cron job (to run wp-cron.php) is scheduled by the system and I found now it used PHP version 7.0 only.

    In the cron configuration, now I call explicitly the php7.4 version and it seems the error is gone.

    Plugin Support Tamirat B. (a11n)

    (@tamirat22)

    Hello @0815martin!

    In the cron configuration, now I call explicitly the php7.4 version and it seems the error is gone.

    Glad to hear it and thanks for letting us know!

    Refer to the compatibility matrix here for more insight: https://woocommerce.com/document/update-php-wordpress/

    If you have any further questions regarding WooCommerce Core, I recommend creating a new thread??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Parse error: syntax error, unexpected ‘?’, expecting variable (T_VARIABLE)’ is closed to new replies.