1
0
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:
Matthew Brown 2019-03-14 10:23:26 -04:00
parent 312be71be1
commit 3704e75049

View File

@ -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);
}
} }
} }