prevent a fatal error on an invalid tsquery syntax

This commit is contained in:
Andrew Dolgov 2019-04-29 21:15:49 +03:00
parent 4f306e61b4
commit 1cd9b3c866
1 changed files with 11 additions and 0 deletions

View File

@ -1434,6 +1434,17 @@ class Feeds extends Handler_Protected {
if (!$search_query_part) {
list($search_query_part, $search_words) = search_to_sql($search, $search_language);
}
if (DB_TYPE == "pgsql") {
$test_sth = $pdo->prepare("select $search_query_part from ttrss_entries limit 1");
try {
$test_sth->execute();
} catch (PDOException $e) {
// looks like tsquery syntax is invalid
$search_query_part = "false";
}
}
$search_query_part .= " AND ";
} else {
$search_query_part = "";