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

Merge pull request #6810 from orklah/castArrayTaints

Array cast pass taints
This commit is contained in:
orklah 2021-11-04 13:17:20 +01:00 committed by GitHub
commit bf993452a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -232,8 +232,7 @@ class CastAnalyzer
$type = Type::getArray(); $type = Type::getArray();
} }
if ($statements_analyzer->data_flow_graph instanceof \Psalm\Internal\Codebase\VariableUseGraph if ($statements_analyzer->data_flow_graph) {
) {
$type->parent_nodes = $stmt_expr_type->parent_nodes ?? []; $type->parent_nodes = $stmt_expr_type->parent_nodes ?? [];
} }

View File

@ -2190,6 +2190,16 @@ class TaintTest extends TestCase
'error_message' => 'TaintedHtml', 'error_message' => 'TaintedHtml',
], ],
*/ */
'castToArrayPassTaints' => [
'<?php
$args = $_POST;
$args = (array) $args;
pg_query($connection, "SELECT * FROM tableA where key = " .$args["key"]);
',
'error_message' => 'TaintedSql',
],
]; ];
} }