Caldav Sync error - Unsupported operand types: string * int
-
Hello,
I just setup my new server with z-push (v2.6.2) and the sync with nextcloud. I tripple checked the setup and config and run into the following error message:
04/04/2021 13:33:49 [ 8100] [WARN] [USER] Unknown:0 Unknown: SECURITY PROBLEM: insecure server advertised AUTH=PLAIN (errflg=1) (8) 04/04/2021 13:33:51 [ 8102] [ERROR] [USER] LoopDetection->ProcessLoopDetectionPreviousConnectionFailed(): Command 'Sync' at 03/04/2021 14:11:39 with pid '6763' terminated unexpectedly or is still running. 04/04/2021 13:33:51 [ 8102] [ERROR] [USER] Please check your logs for this PID and errors like PHP-Fatals or Apache segmentation faults and report your results to the Z-Push dev team. 04/04/2021 13:33:53 [ 8101] [WARN] [USER] Mobile loop detected! Messages sent to the mobile will be restricted to 1 items in order to identify the conflict 04/04/2021 13:33:54 [ 8101] [FATAL] [USER] Fatal error: /usr/share/z-push/backend/caldav/caldav.php:847 - Uncaught TypeError: Unsupported operand types: string * int in /usr/share/z-push/backend/caldav/caldav.php:847 Stack trace: #0 /usr/share/z-push/backend/caldav/caldav.php(596): BackendCalDAV->_ParseVEventToSyncObject() #1 /usr/share/z-push/backend/caldav/caldav.php(254): BackendCalDAV->_ParseVEventToAS() #2 /usr/share/z-push/lib/default/diffbackend/exportchangesdiff.php(160): BackendCalDAV->GetMessage() #3 /usr/share/z-push/lib/request/sync.php(1199): ExportChangesDiff->Synchronize() #4 /usr/share/z-push/lib/request/sync.php(956): Sync->syncFolder() #5 /usr/share/z-push/lib/request/requestprocessor.php(116): Sync->Handle() #6 /usr/share/z-push/index.php(107): RequestProcessor::HandleRequest() #7 {main} thrown (1)
The apache error is:
[Sun Apr 04 13:33:54.545865 2021] [php:error] [pid 8101] [client 192.168.1.151:40578] PHP Fatal error: Uncaught TypeError: Unsupported operand types: string * int in /usr/share/z-push/backend/caldav/caldav.php:847\nStack trace:\n#0 /usr/share/z-push/backend/caldav/caldav.php(596): BackendCalDAV->_ParseVEventToSyncObject()\n#1 /usr/share/z-push/backend/caldav/caldav.php(254): BackendCalDAV->_ParseVEventToAS()\n#2 /usr/share/z-push/lib/default/diffbackend/exportchangesdiff.php(160): BackendCalDAV->GetMessage()\n#3 /usr/share/z-push/lib/request/sync.php(1199): ExportChangesDiff->Synchronize()\n#4 /usr/share/z-push/lib/request/sync.php(956): Sync->syncFolder()\n#5 /usr/share/z-push/lib/request/requestprocessor.php(116): Sync->Handle()\n#6 /usr/share/z-push/index.php(107): RequestProcessor::HandleRequest()\n#7 {main}\n thrown in /usr/share/z-push/backend/caldav/caldav.php on line 847
I have not compared both error messages but there seems to be some similarity. Both other backends (imap and carddav) seem to be running fine. Did anyone else run into that issue? I was running V2.5.2 until recently my server decided to quit it’s service and had no issues what so ever with that version.
I am grateful for any help.
realshadow
-
After a little bit of tinkering and changing I am down to the error message:
04/04/2021 18:33:06 [ 1672] [WARN] [USER] Not possible to determine class of request. Request did not contain class and apparently there is an issue with the HierarchyCache.
Does anyone know what to do about it? I will do a little more investigation but for now that is where I am stuck. I also changed the backend from “combined” to “caldav” only to figure out that module and try each at a time. Somehow this time it is by far more complicated then when I set the sync up with v2.5.2. Weird.
realshadow
-
Anyone any idea about that unsupported operand error? I checked my config several times, changed it from
define('CALDAV_PATH', '/nextcloud/remote.php/dav/calendars/%u/');
to
define('CALDAV_PATH', '/nextcloud/remote.php/dav/calendars/%u/Personal');
and tried about any combination you can imagine. The calendar just won’t work. I checked the path for nextcloud, made sure it uses the right path but I cannot get that to work. Does anyone have any idea why an error like that (unsupported operand) be triggered in the caldav module?
I even checked the backend combined several times to make sure that I defined the right folders in that backend.Please, I really want to get that server back up an running.
Thank you.
realshadow
-
Hi @realshadow,
are you using PHP 8? What is the OS of the server? We didn’t check the if Z-Push code is compatible with it yet.
A quick solution would be to wrap possible string values with int. E.g.
int($interval->format("%h"))
Manfred
-
@manfred Yes I am using PHP8. I was thinking that that might be the issue but when I use the installer (DEBIAN10) php8 is being installed automatically so I thought I’ll work with it. Let me implement what you suggested and I’ll get back to you in a few minutes.
I assume I have to put that piece of code into the CaldDav.php backend file?Thanks.
-
Hi @realshadow,
@realshadow said in Caldav Sync error - Unsupported operand types: string * int:
@manfred Yes I am using PHP8. I was thinking that that might be the issue but when I use the installer (DEBIAN10) php8 is being installed automatically so I thought I’ll work with it. Let me implement what you suggested and I’ll get back to you in a few minutes.
What installer are you using? According to the debian wiki the default PHP version for debian 10 is 7.3: https://wiki.debian.org/DebianBuster#Packages_.26_versions. It would surprise me a lot if debian would update a major PHP version in their minor release.
I assume I have to put that piece of code into the CaldDav.php backend file?
Yes, that example was specifically for the caldav.php, but there are probably more places in code which need adjustments.
Z-Push doesn’t support PHP 8 yet, so even if you’ll get that to work, there’s no guarantee it will be stable enough to use it productively. I suggest you to go with PHP 7.
Manfred
-
@manfred
I replaced the line 847 in the caldav.php from$message->reminder = $interval->format("%i") + $interval->format("%h") * 60 + $interval->format("%a") * 60 * 24;
with
$message->reminder = int($interval->format("%i")) + int($interval->format("%h")) * 60 + int($interval->format("%a")) * 60 * 24;
that is giving me the error message:
05/04/2021 13:16:10 [ 6014] [FATAL] [USER] Fatal error: /usr/share/z-push/backend/caldav/caldav.php:848 - Uncaught Error: Call to undefined function int() in /usr/share/z-push/backend/caldav/caldav.php:847
With your earlier indication that PHP8 could not be compatible with the latest z-push I will uninstall all php8.0 modules that were installed on that server. I will then install 7.4 and see if I can make that work. That will probably take me the better part of today and tomorrow. I might just setup a new VM all together.
Let me get back to you tomorrow about what I find. Thanks so much for your help. I really appreciate your help and the effort you put into z-push. I love this tool and can’t wait to have it back up an running again. -
@manfred That is perfect. Thanks for that feedback. I will install 7.4 again. Debian by default uses 7.3. That might be the one I will go with. Thanks again. I’ll get back to tomorrow as that will take me some time to change and update.
-
Hi @realshadow,
sorry, the function is intval, not int, but to go with PHP 7 is a better option for now anyway.
Manfred
-
@manfred Good morning,
I refreshed my server and removed any remnants of php8. I then reinstalled and reconfigured z-push. By default php7.3 was installed. I managed to get the synchronization running partially again. I am still getting error messages that a “non numeric value was encountered” more precisely
06/04/2021 08:58:57 [27730] [WARN] [USER] /usr/share/z-push/backend/caldav/caldav.php:847 A non-numeric value encountered (2)
and my calendars for birthdays is not being picked up and the main calendar which was listed as “personal” before does show up as default in Outlook. I am also getting weird behaviour that the inbox is synchronized but as soon as I do anything the inbox suddenly is empty and does not resync until I reopen Outlook. The error message I get at that point is
06/04/2021 09:31:43 [27754] [ INFO] [USER] StatusException: Folderid not found in cache - code: 12 - file: /usr/sha re/z-push/backend/imap/imap.php:1013
I will now try to recreate my Outlook profile and resync again. I hope that provides me with a better idea what is happening.
realshadow
-
@manfred
All right after deleting and recreating my outlook profile everything is working again. Error message is still there but as far as I can tell the sync is updating everything into my outlook. I will do some more testing but
THANK YOU
for that simple but effective information. I am so excited to be back up and running.realshadow
-
@manfred I have a question for you. That is somewhat related but I need to understand something. If, by changing the code for the caldav.php file, the error message would disappear, why is that not part of the code base already? I cannot be the first one to encounter this issue, tons of people work with Outlook and seeing what issues are created within php8 should that not be done? Even with the current php7.3 you already get an error message but the sync still works. Why are not all of the commands enclosed by intval? Seems like an easy fix to me. Would that create another issue on another backend side?
Thanks so much for your feedback.
realshadow
-
Hi @Realshadow,
@realshadow said in Caldav Sync error - Unsupported operand types: string * int:
@manfred I have a question for you. That is somewhat related but I need to understand something. If, by changing the code for the caldav.php file, the error message would disappear, why is that not part of the code base already?
The caldav backend is a community contribution and we (Sebastian and I) are not very actively involved in its development. I don’t use this backend daily, so before your post I wasn’t even aware that this issue existed. I suppose the regular backend contributors also aren’t aware of it, that’s why it hasn’t been fixed yet.
@realshadow said in Caldav Sync error - Unsupported operand types: string * int:
I cannot be the first one to encounter this issue, tons of people work with Outlook and seeing what issues are created within php8 should that not be done? Even with the current php7.3 you already get an error message but the sync still works.
Maybe you’re not the first to encounter the issue, but you’re the first I’m hearing about it. It would help if you would also open an issue at Z-Push Jira https://jira.z-hub.io/browse/ZP, so that someone would pick it up.
@realshadow said in Caldav Sync error - Unsupported operand types: string * int:
Why are not all of the commands enclosed by intval? Seems like an easy fix to me. Would that create another issue on another backend side?
Thanks so much for your feedback.
realshadow
I don’t think it would created other issues, but someone has to fix it and test it and as far as I saw it, PHP 8 is not yet a part of major linux distributions, so that’s also a possibility why nobody has fixed it yet.
Manfred
-
@manfred Thank you very much for your response. I appreciate it. I will open a JIRA ticket to ensure visibility of that issue.
-
There is a branch ZP-1571 which contains a fix already.
(Commit: https://stash.z-hub.io/projects/ZP/repos/z-push/commits/5df5573b4f6bda362ee80d94e07d7cbefbc2a1eb )The usage of $interval->format("%a") in line 847 on a DateInterval is wrong, because this will never return a valid result.
It should be:
$message->reminder = $interval->format("%i") + $interval->format("%h") * 60 + $interval->format("%d") * 60 * 24;