Google calender sync doesn't work anymore after moving to php 8.0

SupportGoogle calender sync doesn't work anymore after moving to php 8.0
mvb Staff asked 2 years ago
Hello, our provider updated php to version 8 (from 7.6). Since then, the google sync does not work anymore. It has been working without issues before the move to php 8. Have you seen this issue before and what can be done about this?
9 Answers
Nikola Loncar Staff answered 2 years ago
Hi, can you please check error log file on your hosting? Sound like issue with some other plugin that is preventing EA from working. We have locally versions that are running under PHP8 Best regards, Nikola
mvb Staff answered 2 years ago
Dear Nikola, This is what the log shows: AH01215: PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /mnt/web305/c0/04/59701287/htdocs/WordPress_01/wp-content/plugins/easy-appointments-connect/vendor/google/apiclient/src/Google/Http/REST.php:173: /home/strato/http/power/rid/12/04/59701287/htdocs/WordPress_01/wp-cron.php Hope this is of any help to you.  gr Michiel
Nikola Loncar Staff answered 2 years ago
Hi, how many records are there with such error? We are having servers with PHP8 and sync doesn't generate any errors. :( Best regards, Nikola
mvb Staff answered 2 years ago
Hi, lots of them; every time the website is calling wp-cron.php, there is this error.  
mvb Staff answered 2 years ago
Hi Nikola, did some debugging myself and changed line 173 of rest.php to: //$requestUrl .= '?' . implode($queryVars, '&');
$requestUrl .= '?' . implode('&', $queryVars); Now it seems to work again.  Documentation I used for this: https://www.php.net/manual/en/function.implode.php Best Michiel
Nikola Loncar Staff answered 2 years ago
Hi Michiel, that rest.php is not part of EA? Best regards, Nikola
mvb Staff answered 2 years ago
Hi Nikola, I believe it is, as it is stored in this location: wp-content/plugins/easy-appointments-connect/vendor/google/apiclient/src/Google/Http/REST.php When there is an update on your easy-appointments-connect plugin, I will keep an eye on this specific rest.php file. For now, everything is back to working so I am happy.  gr. Michiel
Nikola Loncar Staff answered 2 years ago
Thanks, we will see what can be done there. It is official Google API client. Best regards, Nikola
manuel_jeanne Staff answered 2 years ago
Hi, same problem for me. REST.php isn't compatible with php 8. Need to change :
$requestUrl .= '?' . implode($queryVars, '&');
with
$requestUrl .= '?' . implode('&', $queryVars);
on line 173 as explain here: https://www.php.net/manual/en/function.implode.php Maybe you can just add a simple search and replace fix in next release (sorry if bad english, not my natural language)