mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +01:00
Preserve reconciled taints for all but non-string scalar types
This commit is contained in:
parent
6095800fc5
commit
b68995582e
@ -309,7 +309,7 @@ class Reconciler
|
||||
}
|
||||
|
||||
if (($statements_analyzer->data_flow_graph instanceof \Psalm\Internal\Codebase\TaintFlowGraph
|
||||
&& $result_type->hasString())
|
||||
&& (!$result_type->hasScalarType()) || $result_type->hasString())
|
||||
|| $statements_analyzer->data_flow_graph instanceof \Psalm\Internal\Codebase\VariableUseGraph
|
||||
) {
|
||||
if ($before_adjustment && $before_adjustment->parent_nodes) {
|
||||
|
@ -1534,6 +1534,21 @@ class TaintTest extends TestCase
|
||||
}',
|
||||
'error_message' => 'TaintedInput',
|
||||
],
|
||||
'taintReturnedArray' => [
|
||||
'<?php
|
||||
function processParams(array $params) : array {
|
||||
if (isset($params["foo"])) {
|
||||
return $params;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
$params = processParams($_GET);
|
||||
|
||||
echo $params["foo"];',
|
||||
'error_message' => 'TaintedInput',
|
||||
],
|
||||
/*
|
||||
// TODO: Stubs do not support this type of inference even with $this->message = $message.
|
||||
// Most uses of getMessage() would be with caught exceptions, so this is not representative of real code.
|
||||
|
Loading…
Reference in New Issue
Block a user