Skip to content

Commit cf114bf

Browse files
Merge pull request #18334 from kamil-tekiela/18333
Cast POST values to expected types
2 parents 365cb4e + bca265b commit cf114bf

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

libraries/classes/Controllers/Table/FindReplaceController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function findAction(): void
146146
&& $_POST['useRegex'] === 'on';
147147

148148
$preview = $this->getReplacePreview(
149-
$_POST['columnIndex'],
149+
(int) $_POST['columnIndex'],
150150
$_POST['find'],
151151
$_POST['replaceWith'],
152152
$useRegex,
@@ -158,10 +158,10 @@ public function findAction(): void
158158
public function replaceAction(): void
159159
{
160160
$this->replace(
161-
$_POST['columnIndex'],
161+
(int) $_POST['columnIndex'],
162162
$_POST['findString'],
163163
$_POST['replaceWith'],
164-
$_POST['useRegex'],
164+
(bool) $_POST['useRegex'],
165165
$this->connectionCharSet,
166166
);
167167
$this->response->addHTML(

psalm-baseline.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3591,11 +3591,6 @@
35913591
<InvalidArrayOffset>
35923592
<code><![CDATA[$GLOBALS['errorUrl']]]></code>
35933593
</InvalidArrayOffset>
3594-
<InvalidScalarArgument>
3595-
<code><![CDATA[$_POST['columnIndex']]]></code>
3596-
<code><![CDATA[$_POST['columnIndex']]]></code>
3597-
<code><![CDATA[$_POST['useRegex']]]></code>
3598-
</InvalidScalarArgument>
35993594
<MixedArgument>
36003595
<code>$column</code>
36013596
<code>$column</code>
@@ -3641,6 +3636,10 @@
36413636
<PossiblyUnusedParam>
36423637
<code>$request</code>
36433638
</PossiblyUnusedParam>
3639+
<RiskyCast>
3640+
<code><![CDATA[$_POST['columnIndex']]]></code>
3641+
<code><![CDATA[$_POST['columnIndex']]]></code>
3642+
</RiskyCast>
36443643
</file>
36453644
<file src="libraries/classes/Controllers/Table/GetFieldController.php">
36463645
<PossiblyInvalidArgument>

0 commit comments

Comments
 (0)