mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
Catch sql parsing exceptions
This commit is contained in:
parent
312be71be1
commit
3704e75049
@ -928,10 +928,16 @@ abstract class Type
|
|||||||
|
|
||||||
if ($value !== null) {
|
if ($value !== null) {
|
||||||
if (stripos($value, 'select ') !== false) {
|
if (stripos($value, 'select ') !== false) {
|
||||||
$parser = new \PhpMyAdmin\SqlParser\Parser($value);
|
try {
|
||||||
|
$parser = new \PhpMyAdmin\SqlParser\Parser($value);
|
||||||
|
|
||||||
if (!$parser->errors) {
|
if (!$parser->errors) {
|
||||||
$type = new TSqlSelectString($value);
|
$type = new TSqlSelectString($value);
|
||||||
|
}
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
if (strlen($value) < 1000) {
|
||||||
|
$type = new TLiteralString($value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user