The check to see if DISTINCT is already set uses the wrong substr() length:

-    if (count($this->fields) && substr($this->fields[0], 0, 7) != 'DISTINCT') {
+    if (count($this->fields) && substr($this->fields[0], 0, 8) != 'DISTINCT') {

This problem exists in all versions I've looked at. The bug was originally reported as part of the views_fast_search module as 108713.

The patch is rather simple (change 7 to 8). A 4.7 patch is attached to the original bug report (108713) and here.

Comments

merlinofchaos’s picture

Status: Needs review » Fixed

Fixed, thanks for the report!

Anonymous’s picture

Status: Fixed » Closed (fixed)