From 103cc3e523104f444a30bbd3bca50677aeb0d63b Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Fri, 31 May 2024 10:27:41 -0700 Subject: [PATCH] fix: Undefined array key 2 Was seeing the following errors in the log: PHP Warning: Undefined array key 2 in /var/www/html/Domain/ReservationItemView.php on line 490 The issue was caused by `array_splice()` After using `array_splice` then `$name_parts` is now only a single element array, as all other elements have been removed and used to generate `$firstnames` --- Domain/ReservationItemView.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Domain/ReservationItemView.php b/Domain/ReservationItemView.php index 12ac6b38a..d511ff923 100644 --- a/Domain/ReservationItemView.php +++ b/Domain/ReservationItemView.php @@ -487,7 +487,7 @@ public function __construct( # more than just one first and one last name $lastIndex = count($name_parts) - 1; $firstnames = implode(' ', array_splice($name_parts, 0, $lastIndex)); - $lastnames = $name_parts[$lastIndex]; + $lastnames = $name_parts[0]; // could be extended to guess which is a middle name etc. } $this->ParticipantIds[] = $id;