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

Merge pull request #10154 from cgocast/5.x

This commit is contained in:
Bruce Weirdan 2023-08-27 05:27:41 +02:00 committed by GitHub
commit 77436b1339
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -15,6 +15,7 @@ class ReflectionClass implements Reflector {
/**
* @param T|class-string<T>|interface-string<T>|trait-string|enum-string<T> $argument
* @psalm-pure
* @psalm-taint-sink callable $argument
*/
public function __construct($argument) {}
@ -424,7 +425,7 @@ class ReflectionFunction extends ReflectionFunctionAbstract
{
/**
* @param callable-string|Closure $function
*
* @psalm-taint-sink callable $function
* @psalm-pure
*/
public function __construct(callable $function) {}

View File

@ -2489,6 +2489,20 @@ class TaintTest extends TestCase
echo pg_escape_string($conn, $_GET["a"]);',
'error_message' => 'TaintedHtml',
],
'taintedReflectionClass' => [
'code' => '<?php
$name = $_GET["name"];
$reflector = new ReflectionClass($name);
$reflector->newInstance();',
'error_message' => 'TaintedCallable',
],
'taintedReflectionFunction' => [
'code' => '<?php
$name = $_GET["name"];
$function = new ReflectionFunction($name);
$function->invoke();',
'error_message' => 'TaintedCallable',
],
];
}