A free open source IT asset/license management system
Locations: Small out of bound fix for php8.5 deprecation
snipeb91f7f9ca7a1
diff --git a/app/Http/Controllers/Api/LocationsController.php b/app/Http/Controllers/Api/LocationsController.phpindex 7665a83068..fa45999657 100644--- a/app/Http/Controllers/Api/LocationsController.php+++ b/app/Http/Controllers/Api/LocationsController.php@@ -490,11 +490,14 @@ class LocationsController extends Controller$locations_with_children = [];+ // Use 0 (not null) for the top-level bucket — null array offsets are+ // deprecated in PHP 8.4 and Location::indenter expects an int key.foreach ($locations as $location) {- if (! array_key_exists($location->parent_id, $locations_with_children)) {- $locations_with_children[$location->parent_id] = [];+ $parentKey = (int) $location->parent_id;+ if (! array_key_exists($parentKey, $locations_with_children)) {+ $locations_with_children[$parentKey] = [];}- $locations_with_children[$location->parent_id][] = $location;+ $locations_with_children[$parentKey][] = $location;}if ($request->filled('search')) {