Skip to content

Commit

Permalink
Merge pull request #7677 from mmcev106/master
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Feb 15, 2022
2 parents 5aa06ae + 828b093 commit 28c5f9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions stubs/CoreGenericFunctions.phpstub
Expand Up @@ -677,6 +677,12 @@ function array_product(array $array) {}
* 259 is FILTER_VALIDATE_FLOAT
* @psalm-taint-escape ($filter is 259 ? 'html' : null)
*
* 519 is FILTER_SANITIZE_NUMBER_INT
* @psalm-taint-escape ($filter is 519 ? 'html' : null)
*
* 520 is FILTER_SANITIZE_NUMBER_FLOAT
* @psalm-taint-escape ($filter is 520 ? 'html' : null)
*
* @psalm-flow ($value, $filter, $options) -> return
*/
function filter_var(mixed $value, int $filter = FILTER_DEFAULT, array|int $options = 0): mixed {}
Expand Down
6 changes: 4 additions & 2 deletions tests/TaintTest.php
Expand Up @@ -232,15 +232,17 @@ function foo() : void {
],
'taintFilterVarInt' => [
'code' => '<?php
echo filter_var($_GET["bad"], FILTER_VALIDATE_INT);'
echo filter_var($_GET["bad"], FILTER_VALIDATE_INT);
echo filter_var($_GET["bad"], FILTER_SANITIZE_NUMBER_INT);'
],
'taintFilterVarBoolean' => [
'code' => '<?php
echo filter_var($_GET["bad"], FILTER_VALIDATE_BOOLEAN);'
],
'taintFilterVarFloat' => [
'code' => '<?php
echo filter_var($_GET["bad"], FILTER_VALIDATE_FLOAT);'
echo filter_var($_GET["bad"], FILTER_VALIDATE_FLOAT);
echo filter_var($_GET["bad"], FILTER_SANITIZE_NUMBER_FLOAT);'
],
'taintLdapEscape' => [
'code' => '<?php
Expand Down

0 comments on commit 28c5f9c

Please sign in to comment.