1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Improve backtrace of property-involved issues

This commit is contained in:
Brown 2019-08-14 11:47:58 -04:00
parent e92896f145
commit 3d01708c6c
2 changed files with 10 additions and 6 deletions

View File

@ -2872,11 +2872,15 @@ class CallAnalyzer
$code_location
);
$existing_sink = $codebase->taint->hasExistingSink($method_sink);
foreach ($input_type->sources as $input_source) {
$existing_source = $codebase->taint->hasExistingSource($input_source);
if (IssueBuffer::accepts(
new TaintedInput(
'in path ' . $codebase->taint->getPredecessorPath($input_source)
. ' out path ' . $codebase->taint->getSuccessorPath($method_sink),
'in path ' . $codebase->taint->getPredecessorPath($existing_source ?: $input_source)
. ' out path ' . $codebase->taint->getSuccessorPath($existing_sink ?: $method_sink),
$code_location
),
$statements_analyzer->getSuppressedIssues()

View File

@ -189,11 +189,11 @@ class Taint
$location_summary = $source->code_location->getQuickSummary();
}
if (isset($visited_paths[$source->id])) {
if (isset($visited_paths[$source->id . ' ' . $location_summary])) {
return '';
}
$visited_paths[$source->id] = true;
$visited_paths[$source->id . ' ' . $location_summary] = true;
$source_descriptor = $source->id . ($location_summary ? ' (' . $location_summary . ')' : '');
@ -221,11 +221,11 @@ class Taint
$location_summary = $sink->code_location->getQuickSummary();
}
if (isset($visited_paths[$sink->id])) {
if (isset($visited_paths[$sink->id . ' ' . $location_summary])) {
return '';
}
$visited_paths[$sink->id] = true;
$visited_paths[$sink->id . ' ' . $location_summary] = true;
$sink_descriptor = $sink->id . ($location_summary ? ' (' . $location_summary . ')' : '');