diff --git a/src/Psalm/Internal/Codebase/TaintFlowGraph.php b/src/Psalm/Internal/Codebase/TaintFlowGraph.php index e3df24071..01ed80faa 100644 --- a/src/Psalm/Internal/Codebase/TaintFlowGraph.php +++ b/src/Psalm/Internal/Codebase/TaintFlowGraph.php @@ -471,6 +471,8 @@ class TaintFlowGraph extends DataFlowGraph $new_source->id = $source->id . '-' . $specialization; + unset($new_source->specialized_calls[$specialization]); + $generated_sources[] = $new_source; } } diff --git a/tests/TaintTest.php b/tests/TaintTest.php index a1c8b2ce5..711417710 100644 --- a/tests/TaintTest.php +++ b/tests/TaintTest.php @@ -1960,6 +1960,21 @@ class TaintTest extends TestCase echo post("x");', 'error_message' => 'TaintedHtml', ], + 'taintSpecializedTwice' => [ + ' '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.