Fixed Find command to work with iPhone running ios 18.4.1
What does this implement/fix? Explain your changes.
This pull request replaces my old pull request implementing the Find command. I took the base code and tested it but ran into an issue:
The Find command implementation:
https://github.com/Z-Hub/Z-Push/blob/af25a2169a50d6e05a5916d1e8b2b6cd17011c98/src/lib/request/find.php#L178
Didn't pass the folderId to the backend Fetch() method:
https://github.com/Z-Hub/Z-Push/blob/af25a2169a50d6e05a5916d1e8b2b6cd17011c98/src/lib/default/diffbackend/diffbackend.php#L129
The message can't be found that way. I also pass the server ID and not the long ID as kopano is the only backend that splits the long ID:
https://github.com/Z-Hub/Z-Push/blob/07f60c76cb46d0c63fc18ac387476b304d379087/src/backend/kopano/kopano.php#L750
The BackendDiff class doesn't do this.
Does this close any currently open issues?
Not sure. But it might close https://github.com/Z-Hub/Z-Push/issues/141
Any relevant logs, error output, etc?
...
Where has this been tested?
Server (please complete the following information):
- OS: debian
- PHP Version: 8.3
- Backend for: Group-Office
- and Version: current development branch
Smartphone (please complete the following information):
- Device: iPhone 13
- OS: iOS 18
- Mail App Apple mail
The backend should handle the long ids, as it generates these ids as it sees fit. ItemOperations doesn't have a folder id iirc so the handling of longids should be done exclusively in the backend IMHO.
OK thanks, I can add this in my backend. But is it ok to pass false to $folderId too?
But is it ok to pass false to $folderId too?
I would say so, yes. That's by design. The longid is self contained. The backend should be able to uniquely identify a message of the user just with this id. The spec gives some good ideas too: https://learn.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-ascmd/552f41c0-33ff-48ab-9fd0-92239e0577f0
@mschering thanks for looking into this search issue - I've run into the same problem. I tried your patch (9575599) and I can now see search results coming from outside of the sync period but I only get Subjects, not the body of the emails returned in the search. Dovecot backend. I see things like BackendIMAP->StatMessage failed to retrieve overview. And StatusException: BackendDiff->Fetch('%s', '%s') Error, unable retrieve message from backend. I don't suppose you have had time to look into this further?
Do you know what folder id and uid it passes to the fetch method?
@mschering so on the most recent Z-Push git version (659ecf8) I get things like this in the log:
z-push-dev | 21/08/2025 12:52:04 [ 39] [WARN] [[email protected]] BackendIMAP->StatMessage('','62ef5173:46656'): Failed to retrieve overview: UID sequence syntax error
z-push-dev | 21/08/2025 12:52:04 [ 39] [WARN] [[email protected]] BackendIMAP->StatMessage('','62ef5173:46656'): Failed to retrieve overview: UID sequence syntax error
z-push-dev | 21/08/2025 12:52:04 [ 39] [ INFO] [[email protected]] StatusException: BackendDiff->Fetch('%s','%s'): Error, unable retrieve message from backend - code: 8 - file: /usr/share/z-push/lib/default/diffbackend/diffbackend.php:134
z-push-dev | 21/08/2025 12:52:04 [ 39] [FATAL] [[email protected]] WBXML 10K debug data: AwFqAAAZRUYDNDJERDczMzYtNDE5Ri00RjY4LUJFQkMtOTU5ODJCRjY5ODk5AAFHSEkAAFADRW1haWwAAVIDZWY2YzEzYjAAAQAZSwN0bzoiVGVzdCIgT1IgY2M6IlRlc3QiIE9SIGZyb206IlRlc3QiIE9SIHN1YmplY3Q6IlRlc3QiIE9SICJUZXN0IiBPUiAiVGVzdCIAAQFMTQMwLTk5AAEOAQEBAQ==
z-push-dev | 21/08/2025 12:52:04 [ 39] [FATAL] [[email protected]] WBXML 10K debug data: AwFqAAAZRUYDNDJERDczMzYtNDE5Ri00RjY4LUJFQkMtOTU5ODJCRjY5ODk5AAFHSEkAAFADRW1haWwAAVIDZWY2YzEzYjAAAQAZSwN0bzoiVGVzdCIgT1IgY2M6IlRlc3QiIE9SIGZyb206IlRlc3QiIE9SIHN1YmplY3Q6IlRlc3QiIE9SICJUZXN0IiBPUiAiVGVzdCIAAQFMTQMwLTk5AAEOAQEBAQ==
z-push-dev | 21/08/2025 12:52:04 [ 39] [ INFO] [[email protected]] User-agent: 'Apple-iPhone17C1/2207.100'
z-push-dev | 21/08/2025 12:52:04 [ 39] [FATAL] [[email protected]] Exception: (StatusException) - BackendDiff->Fetch('%s','%s'): Error, unable retrieve message from backend
z-push-dev | 21/08/2025 12:52:04 [ 39] [FATAL] [[email protected]] Exception: (StatusException) - BackendDiff->Fetch('%s','%s'): Error, unable retrieve message from backend
and in your patched version (9575599) I see things like:
z-push-dev | - - [email protected] 21/Aug/2025:12:55:02 +0100 "POST /Microsoft-Server-ActiveSync" 200
z-push-dev | 21/08/2025 12:55:03 [ 26] [WARN] [[email protected]] BackendIMAP->StatMessage('ef6c13b0','929'): Failed to retrieve overview:
z-push-dev | 21/08/2025 12:55:03 [ 26] [WARN] [[email protected]] BackendIMAP->StatMessage('ef6c13b0','929'): Failed to retrieve overview:
z-push-dev | 21/08/2025 12:55:03 [ 26] [ INFO] [[email protected]] StatusException: BackendDiff->Fetch('%s','%s'): Error, unable retrieve message from backend - code: 8 - file: /usr/share/z-push/lib/default/diffbackend/diffbackend.php:134
z-push-dev | 21/08/2025 12:55:03 [ 26] [ INFO] [[email protected]] cmd='ItemOperations' memory='1.64 MiB/2.00 MiB' time='0.14s' devType='iPhone' devId='5s4d7t6v050kju9s2rfdiep5ma' getUser='[email protected]' from='10.0.0.141' idle='0s' version='2.7.3
z-push-dev | ' method='POST' httpcode='200'
z-push-dev | - - [email protected] 21/Aug/2025:12:55:03 +0100 "POST /Microsoft-Server-ActiveSync" 200
z-push-dev | 21/08/2025 12:55:11 [ 38] [WARN] [[email protected]] BackendIMAP->StatMessage('ef6c13b0','940'): Failed to retrieve overview:
z-push-dev | 21/08/2025 12:55:11 [ 38] [WARN] [[email protected]] BackendIMAP->StatMessage('ef6c13b0','940'): Failed to retrieve overview:
z-push-dev | 21/08/2025 12:55:11 [ 38] [ INFO] [[email protected]] StatusException: BackendDiff->Fetch('%s','%s'): Error, unable retrieve message from backend - code: 8 - file: /usr/share/z-push/lib/default/diffbackend/diffbackend.php:134
z-push-dev | 21/08/2025 12:55:11 [ 38] [ INFO] [[email protected]] cmd='ItemOperations' memory='1.64 MiB/2.00 MiB' time='0.15s' devType='iPhone' devId='5s4d7t6v050kju9s2rfdiep5ma' getUser='[email protected]' from='10.0.0.141' idle='0s' version='2.7.3
z-push-dev | ' method='POST' httpcode='200'
Also in 9575599 I get some odd search results where it looks like the same result is getting returned over and over (as in multiple copies of the same result). Please let me know if I can provide more useful diagnostic information. It's easy for me to switch between versions as I have this all in a Docker container. Test device is an iPhone 16 Pro on 18.6.2.
Is 'ef6c13b0' the correct folder name?
so 'ef6c13b0' is the Inbox and that isn't where the search results are coming from