fix(activesync): avoid foreach on string after calendar instance delete#213
Merged
ralflang merged 1 commit intoJul 24, 2026
Merged
Conversation
When deleting a recurring calendar instance, deleteMessage() overwrote $ids with key($ids) (a string UID). If calendar_delete() then threw, the recovery foreach triggered a PHP warning. Use a separate $deleteIds and normalize to an array before iterating.
ralflang
reviewed
Jul 24, 2026
| * @param array $ids The message ids to delete | ||
| * @param boolean $instanceids If true, $ids is a hash of | ||
| * instanceids => uids. @since 2.23.0 | ||
| * uids => instanceids. @since 2.23.0 |
Member
There was a problem hiding this comment.
Strictly speaking this is a signature BC break.
ralflang
requested changes
Jul 24, 2026
ralflang
left a comment
Member
There was a problem hiding this comment.
I need to re-read this later. The print_r is not great but I must make sure if this is only correcting wrong docs or if you really changed the signature in a BC-incompatible way.
| sprintf( | ||
| 'calendar_delete: %s %s %s', | ||
| print_r($ids, true), | ||
| print_r($deleteIds, true), |
Member
There was a problem hiding this comment.
Don't print_r to the general logger. If you really must dump this data, make it a configurable extra file.
Member
|
Confirmed: This is just a docs fix. We can handle the print_r issue later - I vote for merging. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deleteMessage()when a recurring calendar instance delete fails and the recovery path iterates a string UID.$instanceidsdocblock to match callers (uids => instanceids).Motivation
An iPhone SYNC that removed a recurring instance (
AirSyncBase:InstanceId) causedcalendar_deleteto throw (item not found). The catch block then ranforeach ($ids as $uid)after$idshad been overwritten withkey($ids)(a string), producing:foreach() argument must be of type array|object, string givenChanges
$idsarray; use$deleteIdsfor the connector call.$deleteIdsto an array before the recoveryforeach.Test plan
vendor/bin/phpunit --bootstrap /tmp/core-test-bootstrap.php -c vendor/horde/core/phpunit.xml.dist vendor/horde/core/test/Unit/ActiveSync/DriverDeleteMessageInstanceTest.php/tmp-horde/horde.log