Skip to content
Permalink
Browse files

Fix echo checks

  • Loading branch information...
muglug committed Aug 5, 2019
1 parent b2c0993 commit 87bf907c1e78c122c5c8ec7f75d74eb44b18dd79
Showing with 35 additions and 0 deletions.
  1. +3 −0 src/Psalm/Internal/Analyzer/StatementsAnalyzer.php
  2. +32 −0 tests/TaintTest.php
@@ -515,6 +515,9 @@ function ($line) {
new CodeLocation($this->getSource(), $expr),
$expr,
$context,
false,
false,
false,
true
) === false) {
return false;
@@ -38,6 +38,38 @@ public function deleteUser(PDO $pdo) : void {
$this->analyzeFile('somefile.php', new Context());
}
/**
* @return void
*/
public function testTaintedInputFromReturnTypeToEcho()
{
$this->expectException(\Psalm\Exception\CodeException::class);
$this->expectExceptionMessage('TaintedInput');
$this->project_analyzer->trackTaintedInputs();
$this->addFile(
'somefile.php',
'<?php
class A {
public function getUserId() : string {
return (string) $_GET["user_id"];
}
public function getAppendedUserId() : string {
return "aaaa" . $this->getUserId();
}
public function deleteUser(PDO $pdo) : void {
$userId = $this->getAppendedUserId();
echo $userId;
}
}'
);
$this->analyzeFile('somefile.php', new Context());
}
/**
* @return void
*/

0 comments on commit 87bf907

Please sign in to comment.
You can’t perform that action at this time.