1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Merge pull request #7677 from mmcev106/master

This commit is contained in:
Bruce Weirdan 2022-02-15 22:26:56 +02:00 committed by GitHub
commit 28c5f9c9d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -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 {}

View File

@ -232,7 +232,8 @@ class TaintTest extends TestCase
],
'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
@ -240,7 +241,8 @@ class TaintTest extends TestCase
],
'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