diff --git a/src/Psalm/Internal/Codebase/TaintFlowGraph.php b/src/Psalm/Internal/Codebase/TaintFlowGraph.php index acbfd8259..e3df24071 100644 --- a/src/Psalm/Internal/Codebase/TaintFlowGraph.php +++ b/src/Psalm/Internal/Codebase/TaintFlowGraph.php @@ -222,7 +222,7 @@ class TaintFlowGraph extends DataFlowGraph /** * @param array $source_taints * @param array $sinks - * @return array + * @return list */ private function getChildNodes( DataFlowNode $generated_source, @@ -441,7 +441,7 @@ class TaintFlowGraph extends DataFlowGraph $new_destination->specialized_calls = $generated_source->specialized_calls; $new_destination->path_types = array_merge($generated_source->path_types, [$path_type]); - $new_sources[$to_id] = $new_destination; + $new_sources[] = $new_destination; } return $new_sources; @@ -459,11 +459,10 @@ class TaintFlowGraph extends DataFlowGraph if ($source->specialization_key && isset($this->specialized_calls[$source->specialization_key])) { $generated_source = clone $source; - $generated_source->specialized_calls[$source->specialization_key] - = $this->specialized_calls[$source->specialization_key]; - $generated_source->id = substr($source->id, 0, -strlen($source->specialization_key) - 1); + $generated_source->specialized_calls[$source->specialization_key][$generated_source->id] = true; + $generated_sources[] = $generated_source; } elseif (isset($this->specializations[$source->id])) { foreach ($this->specializations[$source->id] as $specialization => $_) { diff --git a/tests/TaintTest.php b/tests/TaintTest.php index fecd45855..a1c8b2ce5 100644 --- a/tests/TaintTest.php +++ b/tests/TaintTest.php @@ -1940,6 +1940,26 @@ class TaintTest extends TestCase echo foo($_GET["foo"], false);', 'error_message' => 'TaintedHtml', ], + 'suppressOneCatchAnother' => [ + ' 'TaintedHtml', + ], /* // 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.