Skip to content

Commit 0cdec16

Browse files
carlbennettclaude
andcommitted
Sanitize pktapplayer query param in Packet/Index controller
Fixes a TypeError when pktapplayer is submitted as a plain string (e.g. ?pktapplayer= or ?pktapplayer=1) instead of an array, which would fail assignment to the array-typed model property. Now handles both string and array input, and strips empty strings before casting to int so blank values don't silently become zero. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5e6f78a commit 0cdec16

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/Controllers/Packet/Index.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public function invoke(?array $args): bool
1616

1717
$q = \BNETDocs\Libraries\Core\Router::query();
1818
$this->model->order = isset($q['order']) ? $q['order'] : 'packet-id-asc';
19-
$this->model->pktapplayer = isset($q['pktapplayer']) ? $q['pktapplayer'] : [];
19+
$pktapplayer = !isset($q['pktapplayer']) ? [] : (is_array($q['pktapplayer']) ? $q['pktapplayer'] : [$q['pktapplayer']]);
20+
$this->model->pktapplayer = array_map('intval', array_filter($pktapplayer, fn($v) => $v !== ''));
2021

2122
switch ($this->model->order)
2223
{

0 commit comments

Comments
 (0)