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:
1 parent
bb1901fed6
commit
cdf04823b0
1 file changed
+4
-2
@@ -421,10 +421,12 @@ class DateService implements SingletonInterface
|
|||||||
// Sort by category
|
// Sort by category
|
||||||
foreach ($priceTable as $category => $rows)
|
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) {
|
uasort($rows, function ($a, $b) {
|
||||||
return strcmp(
|
return strcmp(
|
||||||
$a['rooms'][Hotel::CATEGORY_SUPER_DELUXE]['price'],
|
$a['rooms'][Hotel::CATEGORY_SUPER_DELUXE]['price'] ?? '',
|
||||||
$b['rooms'][Hotel::CATEGORY_SUPER_DELUXE]['price']
|
$b['rooms'][Hotel::CATEGORY_SUPER_DELUXE]['price'] ?? ''
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
$priceTable[$category] = $rows;
|
$priceTable[$category] = $rows;
|
||||||
|
|||||||
Reference in new issue
Block a user