Commit 7c6a7872 authored by Steven Wittens's avatar Steven Wittens
Browse files

- #16111: bad quotes in db_rewrite_sql

parent 95907f0c
......@@ -231,7 +231,7 @@ function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $
list($join, $where, $distinct) = _db_rewrite_sql($query, $primary_table, $primary_field, $args);
if ($distinct) {
$field_to_select = 'DISTINCT($primary_table .'.'. $primary_field)';
$field_to_select = 'DISTINCT('. $primary_table .'.'. $primary_field .')';
// (?<!text) is a negative look-behind (no need to rewrite queries that already use DISTINCT).
$query = preg_replace('/(SELECT.*)('. $primary_table .'\.)?(?<!DISTINCT\()(?<!DISTINCT\('. $primary_table .'\.)'. $primary_field .'(.*FROM)/AUsi', '\1'. $field_to_select .'\3', $query);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment