1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Fix #3711 - generalize call of specialized class without specializations

This commit is contained in:
Brown 2020-06-29 17:42:01 -04:00
parent ab29ac0e51
commit e56483bb54
2 changed files with 13 additions and 1 deletions

View File

@ -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;

View File

@ -1411,6 +1411,18 @@ class TaintTest extends TestCase
}',
'error_message' => 'TaintedInput',
],
'taintSpecializedMethod' => [
'<?php
/** @psalm-taint-specialize */
class Unsafe {
public function isUnsafe() {
return $_GET["unsafe"];
}
}
$a = new Unsafe();
echo $a->isUnsafe();',
'error_message' => 'TaintedInput',
],
];
}
}