diff --git a/inc/caldav-REPORT-calquery.php b/inc/caldav-REPORT-calquery.php
index c0ec60a9..8e062d94 100644
--- a/inc/caldav-REPORT-calquery.php
+++ b/inc/caldav-REPORT-calquery.php
@@ -456,7 +456,15 @@ if ( $qry->Exec("calquery",__LINE__,__FILE__) && $qry->rows() > 0 ) {
$expanded = expand_event_instances($vResource, $expand_range_start, $expand_range_end, $expand_as_floating , $dav_object->collection_tzid);
- if ( $expanded->ComponentCount() == 0 ) continue;
+ # An empty expansion only proves a non-match when the expansion
+ # window equals the requested range. For an open-ended time-range
+ # ($range_filter->until is null) the window is artificially capped
+ # (expand_range_end defaults to time_range_start + 730 days), so a
+ # future or sparsely-recurring event whose next instance lies beyond
+ # the cap must NOT be dropped here -- the getVCalendarRange()->overlaps()
+ # test above is already exact for open ranges. Only enforce the
+ # empty-window skip for a real upper bound or an explicit expansion.
+ if ( $expanded->ComponentCount() == 0 && ( $need_expansion || isset($range_filter->until) ) ) continue;
# We only keep the expanded instaneces if need_expansion is set,
# RFC4791 Section 7.4. Otherwise we should return the original
diff --git a/testing/tests/regression-suite/0555-iPhone-REPORT.result b/testing/tests/regression-suite/0555-iPhone-REPORT.result
index 9a7a3ad2..0fa801d8 100644
--- a/testing/tests/regression-suite/0555-iPhone-REPORT.result
+++ b/testing/tests/regression-suite/0555-iPhone-REPORT.result
@@ -2,8 +2,8 @@ HTTP/1.1 207 Multi-Status
Date: Dow, 01 Jan 2000 00:00:00 GMT
DAV: 1, 2, 3, access-control, calendar-access, calendar-schedule
DAV: extended-mkcol, bind, addressbook, calendar-auto-schedule, calendar-proxy
-ETag: "6ad84d1cc9770bcf7085b8316a7b7791"
-Content-Length: 614
+ETag: "07e5733ac3d62135fd59bf6e733f174f"
+Content-Length: 1103
Content-Type: text/xml; charset="utf-8"
@@ -28,5 +28,25 @@ Content-Type: text/xml; charset="utf-8"
HTTP/1.1 200 OK
+
+ /caldav.php/user1/home/0544-gzip-PUT.ics
+
+
+ "6ddd18264a9d40c1c9d37a005eeb7e4f"
+
+
+ HTTP/1.1 200 OK
+
+
+
+ /caldav.php/user1/home/0545-deflate-PUT.ics
+
+
+ "4a3aa58a3e11487e87d87024465d4182"
+
+
+ HTTP/1.1 200 OK
+
+