• My website is based on WordPress and the so-called ‘Hygge’ theme. I did no changes to the Website, but the website started to display a parse error: “Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in /home/customer/www/tracemaker.com/public_html/wp-content/plugins/wp-less/vendor/wikimedia/less.php/lib/Less/Version.php on line 11”

    I updated Wp less but the situation got worse (i.e., I cannot access to the wp-admin login page). I suppose that the Wp less plugin is not compatible with the latest WordPress version, or with the current PHP version. How can I solve the problem?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author oncletom

    (@oncletom)

    Which version of PHP do you use?

    I’d suggest you bump it to something more recent, like at least PHP 7.

    @oncletom I have the same error as well. I have PHP v7.0.

    Why does it say that it expects variable instead of const? Is there something simple to fix it?

    The lines in question are in vendor/wikimedia/less.php/lib/Less/Version.php:

    class Less_Version {
    public const version = '3.1.0';
    public const less_version = '2.5.3';
    public const cache_version = '253';
    }

    Thank you!

    Thread Starter andreawpless

    (@andreawpless)

    I solved it using PHP 7.4.23. Specifically, It seems that there is a minimum and a MAXIMUM version of PHP to work with, i.e., PHP 8.0.010 (and higher) is the problem. Specifically:
    – with PHP 7.133 the website works
    – with PHP 7.2.34 the website works
    – with PHP 7.3.30 the website works
    – with PHP 7.4.23 the website works
    – with PHP 8.0.010 “Warning: The magic method Vc_Manager::__wakeup() must have public visibility in /home/customer/www/tracemaker.com/public_html/wp-content/plugins/js_composer/js_composer.php on line 221”

    I deleted the word “public” from each of the 3 lines and it seems to work on my PHP v7.0.32.

    • This reply was modified 3 years, 2 months ago by pinkish1.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Parse error: syntax error, unexpected ‘const’’ is closed to new replies.