- Issue created by @johnv
- Assigned to sarwan_verma
- Issue was unassigned.
- Status changed to Needs review
8 months ago 10:42am 8 April 2024 - last update
8 months ago 10 pass - 🇮🇳India sarwan_verma
Hi @johnv,
I have fixed this issue "Warning: Undefined array key 0 in OfficeHoursItemList->addOfficeHours()" and also attached patch,kindly review and verify.
- 🇳🇱Netherlands johnv
Wow, you are fast :-)
Thanks!I propose the following shorter code, using the new PHP8 '??' operator.
@@ -226,7 +227,7 @@ trait OfficeHoursFormatterTrait { // Get date of $day for the exception day lookup. $date = strtotime($day - 1 . ' day ' . $week . ' week midnight'); if (isset($sorted_list[$date])) { - $exception_day = $sorted_list[$date][0]->day; + $exception_day = $sorted_list[$date][0]->day ?? NULL; if ($replace_exceptions || $day !== $exception_day) { // Add day data per day. // Only replace exceptions, not normal weekday,
- 🇳🇱Netherlands johnv
In the end, that piece of code contained more obsolete code lines. So I added the committec patch.
- Status changed to Fixed
8 months ago 3:34pm 8 April 2024 Automatically closed - issue fixed for 2 weeks with no activity.