A free open source IT asset/license management system
Fixed RB-22047 - normalize the request to prevent 500 when passing an array
snipeadc9f47febc0
diff --git a/app/Http/Controllers/MaintenancesController.php b/app/Http/Controllers/MaintenancesController.phpindex 172a900183..a438f9df17 100644--- a/app/Http/Controllers/MaintenancesController.php+++ b/app/Http/Controllers/MaintenancesController.php@@ -33,6 +33,14 @@ class MaintenancesController extends Controller{$this->authorize('view', Asset::class);+ // Normalize array-shaped query probes (?completed[$ptt]=true)+ // on the request itself so every downstream read in the blade+ // and included partials sees a string.+ request()->merge([+ 'completed' => is_string(request()->input('completed')) ? request()->input('completed') : 'false',+ 'upcoming_status' => is_string(request()->input('upcoming_status')) ? request()->input('upcoming_status') : '',+ ]);+return view('maintenances.index');}diff --git a/tests/Feature/Maintenances/Ui/MaintenanceIndexTest.php b/tests/Feature/Maintenances/Ui/MaintenanceIndexTest.phpindex daa41b7c7a..576a8a9f0f 100644--- a/tests/Feature/Maintenances/Ui/MaintenanceIndexTest.php+++ b/tests/Feature/Maintenances/Ui/MaintenanceIndexTest.php@@ -13,4 +13,11 @@ class MaintenanceIndexTest extends TestCase->get(route('maintenances.index'))->assertOk();}++ public function test_page_renders_with_array_shaped_query_param_probes()+ {+ $this->actingAs(User::factory()->superuser()->create())+ ->get('/maintenances?completed[$ptt]=true&upcoming_status[$ptt]=overdue')+ ->assertOk();+ }}