prevent crashes on filter regexp being too advanced for our database when testing filters (refs #508)

This commit is contained in:
Andrew Dolgov 2012-10-23 16:58:07 +04:00
parent 6e577ba157
commit dd8c36af4b
1 changed files with 14 additions and 1 deletions

View File

@ -2321,7 +2321,20 @@
$override_order = "updated DESC";
$filter_query_part = filter_to_sql($filter) . " AND";
$filter_query_part = filter_to_sql($filter);
// Try to check if SQL regexp implementation chokes on a valid regexp
$result = db_query($link, "SELECT true FROM ttrss_entries
WHERE $filter_query_part LIMIT 1", false);
$test = db_fetch_result($result, 0, "true");
if (!$test) {
$filter_query_part = "false AND";
} else {
$filter_query_part .= " AND";
}
} else {
$filter_query_part = "";
}