1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00

Merge pull request #6553 from orklah/exec-leak

This commit is contained in:
Bruce Weirdan 2021-09-30 21:32:55 +03:00 committed by GitHub
commit d232cc0d02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 2 deletions

View File

@ -968,8 +968,12 @@ class ArgumentsAnalyzer
$function_param = $last_param;
}
$by_ref_type = $function_param->type;
$by_ref_out_type = $function_param->out_type;
if ($function_param->type) {
$by_ref_type = clone $function_param->type;
}
if ($function_param->out_type) {
$by_ref_out_type = clone $function_param->out_type;
}
if ($by_ref_type && $by_ref_type->isNullable()) {
$check_null_ref = false;

View File

@ -1602,6 +1602,22 @@ class FunctionCallTest extends TestCase
foo($s);
}',
],
'preventObjectLeakingFromCallmapReference' => [
'<?php
function one(): void
{
try {
exec("", $output);
} catch (Exception $e){
}
}
function two(): array
{
exec("", $lines);
return $lines;
}',
],
];
}