Update:
My server runs PHP version 7.3.15 (Supports 64bit values)
PHP manual states “Arrow functions were introduced in PHP 7.4 ”
Should I downgrade the plugin to the previous version?
Thank you, I clearly missed that. I’ve added a fix for this as version 2.1.1. If you upgrade to 2.1.1 and are still seeing that error, I can look for more, but I think I was able to quickly catch anything that is incorrectly excluding PHP versions older than 7.4.
Hello,
After the upgrade to the 2.1.1 version, i have always the same error !
My server is a Debian 10, with PHP 7.3.
The errors is not solve apparently !
Got error ‘PHP message: PHP Parse error: syntax error, unexpected ‘=>’ (T_DOUBLE_ARROW), expecting ‘)’ in /home/molinari/www/wp-content/plugins/object-sync-for-salesforce/classes/class-object-sync-sf-sync-transients.php on line 5
Best regards
@supportnt Does it really say “line 5”? There’s no code like that at line 5, so I’m curious if it is showing a different line of code that got cut off?
Sorry, it’s the line 59 😉
Bad copy-paste !
Best rergards
@supportnt line 59 should only run if your PHP version is above 7.4. Can you add error_log( 'php version is ' . PHP_VERSION );
right above that line and report what it says? I’d like to find out why the detection isn’t working for you.
@jonathanstegall I believe you are correct that line 59 should only run on PHP >= 7.4, but I think PHP will try to compile the line in any case, and then the Syntax Error occurs. In other words, I don’t think the if clause will prevent the PHP 7.3 compiler from throwing the “CRITICAL syntax error, unexpected ‘=>’ (T_DOUBLE_ARROW)” and crashing the site.
I cannot find a better solution so I will try to upgrade my PHP version as soon as possible.
My temporary workaround was to comment out the offending lines.
We have the same error. (Our server runs PHP 7.3.32 even though php 7.4 dates to 2018).
Unfortunately ofrayechiel is correct. When Zend added arrow functions in 7.4, it now throws errors in the syntax parser of existing, older versions of PHP.
I think the only viable long term solution for us is to upgrade to at least PHP 7.4. But even 7.4 is already in end of life security fix mode, and Zend is now developing PHP 8.0.
In the short term, if this new arrow syntax is necessary to run on 7.4 (I do not believe that this is the case–I know them from js, where arrow functions are a convenient shorthand), the plugin probably should now state it requires php 7.4.
-
This reply was modified 2 years, 10 months ago by timr.
-
This reply was modified 2 years, 10 months ago by timr.
I did not realize the arrow functions were still being parsed. I’ll release a version that removes them as soon as I can (trying to figure out if there is another bug in this release that needs to be addressed first); I certainly don’t think it’s essential to have them in the plugin.
To give an update on this, I’ve released a version 2.1.2 that I believe fixes many, and possibly all, of the reported issues with 2.1.1. I’m not going to close this (or the others) yet, to give folks some time to verify whether the issues are still happening.
I’m going to go ahead and close these 2.1.1-specific issues with the assumption that 2.1.2 is working well for folks.