Skip to content

Commit

Permalink
error on from table-name create from function-call (#459)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored Feb 26, 2023
1 parent 31e91bb commit b7d0f28
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/rules/data/syntax-error-in-prepared-statement.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,4 +351,14 @@ public function testInvalidDeleteUpdateInsert(Connection $conn)
]);
}

/**
* @return string|false
*/
private function returnsUnion() {}

public function bug458(Connection $conn)
{
$table = $this->returnsUnion();
$conn->executeQuery('SELECT * FROM ' . $table . ' LIMIT 1');
}
}
11 changes: 11 additions & 0 deletions tests/rules/data/syntax-error-in-query-function.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,15 @@ public function bug442(\mysqli $mysqli, string $table)
{
mysqli_query($mysqli, "SELECT * FROM `$table`");
}

/**
* @return string|false
*/
private function returnsUnion() {}

public function bug458(\mysqli $mysqli)
{
$table = $this->returnsUnion();
mysqli_query($mysqli,'SELECT * FROM ' . $table . ' LIMIT 1');
}
}
11 changes: 11 additions & 0 deletions tests/rules/data/syntax-error-in-query-method.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,15 @@ public function testInvalidDeleteUpdateInsert(PDO $pdo)
$pdo->query('REPLACE into adasfd SET email="sdf"');
}

/**
* @return string|false
*/
private function returnsUnion() {}

public function bug458(PDO $pdo)
{
$table = $this->returnsUnion();
$pdo->query('SELECT * FROM ' . $table . ' LIMIT 1');
}

}

0 comments on commit b7d0f28

Please sign in to comment.