From cdf04823b0cd7c48deb9bff889986e4e5c16161c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 21 Oct 2026 21:20:09 +0200 Subject: [PATCH] fix: no warnings when a hotel has no 4-person price in the event price table The hotels of an event price table are sorted by their 4-person room price (rooms are keyed by pax). Hotels without one raised 'Undefined array key 4' / 'array offset on null' on every request; they now compare as '' like PHP 7.4 read the missing offset, so the order is unchanged. Co-Authored-By: Claude Opus 5.5 --- packages/ep_products/Classes/Service/DateService.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/ep_products/Classes/Service/DateService.php b/packages/ep_products/Classes/Service/DateService.php index 0746a7f..3163ad0 100644 --- a/packages/ep_products/Classes/Service/DateService.php +++ b/packages/ep_products/Classes/Service/DateService.php @@ -421,10 +421,12 @@ class DateService implements SingletonInterface // Sort by category foreach ($priceTable as $category => $rows) { + // The rooms are keyed by pax, so this compares the 4-person prices; hotels without + // one compare as '' (what PHP 7.4 read from the missing offset) uasort($rows, function ($a, $b) { return strcmp( - $a['rooms'][Hotel::CATEGORY_SUPER_DELUXE]['price'], - $b['rooms'][Hotel::CATEGORY_SUPER_DELUXE]['price'] + $a['rooms'][Hotel::CATEGORY_SUPER_DELUXE]['price'] ?? '', + $b['rooms'][Hotel::CATEGORY_SUPER_DELUXE]['price'] ?? '' ); }); $priceTable[$category] = $rows;