diff --git a/src/Psalm/Internal/Codebase/Taint.php b/src/Psalm/Internal/Codebase/Taint.php index 9d4259b6f..429e95806 100644 --- a/src/Psalm/Internal/Codebase/Taint.php +++ b/src/Psalm/Internal/Codebase/Taint.php @@ -344,7 +344,7 @@ class Taint $generated_sources[] = $generated_source; } elseif (isset($this->specializations[$source->id])) { foreach ($this->specializations[$source->id] as $specialization => $_) { - if (isset($source->specialized_calls[$specialization])) { + if (!$source->specialized_calls || isset($source->specialized_calls[$specialization])) { $new_source = clone $source; $new_source->id = $source->id . '-' . $specialization; diff --git a/tests/TaintTest.php b/tests/TaintTest.php index b1b4f49f9..7dc5b05fd 100644 --- a/tests/TaintTest.php +++ b/tests/TaintTest.php @@ -1411,6 +1411,18 @@ class TaintTest extends TestCase }', 'error_message' => 'TaintedInput', ], + 'taintSpecializedMethod' => [ + 'isUnsafe();', + 'error_message' => 'TaintedInput', + ], ]; } }