From d7e0b132ee7a4172fa94e85d33d302350eafef26 Mon Sep 17 00:00:00 2001 From: Neil Drumm <drumm@3064.no-reply.drupal.org> Date: Thu, 24 Aug 2006 06:36:51 +0000 Subject: [PATCH] #79904 by chx. More strict db_rewrite_sql() regexp. --- includes/database.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/database.inc b/includes/database.inc index 7fca7a2b5867..e9c67113809d 100644 --- a/includes/database.inc +++ b/includes/database.inc @@ -280,7 +280,7 @@ function db_rewrite_sql($query, $primary_table = 'n', $primary_field = 'nid', $ if ($distinct) { $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); + $query = preg_replace('/(SELECT.*)('. $primary_table .'\.)?(?<!DISTINCT\()(?<!DISTINCT\('. $primary_table .'\.)'. $primary_field .'(.*FROM )/AUsi', '\1'. $field_to_select .'\3', $query); } if (!empty($where) || !empty($join)) { -- GitLab