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 <[email protected]>
This commit is contained in:
frommeandClaude Opus 5.5 committed 2026-10-21 21:20:09 +02:00
1 parent bb1901fed6
commit cdf04823b0
1 file changed
+4 -2
@@ -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;