WPIntell

Source evidence

Parse error: syntax error, unexpected ‘const’

WP-LESS · support · 2021-09-12T08:24:00+00:00

complaintsentiment
mediumseverity
0.86relevance
4replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

2 / 14 rows with source links

14.3% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

12 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
andreawpless unresolved
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? 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! 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 4 years, 8 months ago by pinkish1 .

Comments

4 shown
thom4 2021-09-22T06:40:00+00:00

Which version of PHP do you use? I’d suggest you bump it to something more recent, like at least PHP 7.

pinkish1 2021-09-22T11:54:00+00:00

@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!

andreawpless 2021-09-22T12:02:00+00:00

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”

pinkish1 2021-09-22T12:03:00+00:00

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 4 years, 8 months ago by pinkish1 .