From 3f155792a778f0c215fe242bdc5e4202e2d137be Mon Sep 17 00:00:00 2001 From: Matt Brown Date: Fri, 4 Dec 2020 15:44:24 -0500 Subject: [PATCH] Allow nested specialisation --- src/Psalm/Internal/Codebase/TaintFlowGraph.php | 2 ++ tests/TaintTest.php | 15 +++++++++++++++ 2 files changed, 17 insertions(+) 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.