Add whitespace before condition in UserSearchForm
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 15 Mar 2021 11:16:06 +0000 (12:16 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 15 Mar 2021 11:16:06 +0000 (12:16 +0100)
Currently a query like the following is generated:

    SELECT user_table.userID
    FROM wcf1_user user_table
    LEFT JOIN wcf1_user_option_value option_value
    ON (option_value.userID = user_table.userID)WHERE option_value.userOption4 = ?

This works due to the parentheses around the `ON` part of the `JOIN`, but it
certainly is not pretty and it will cause issues if the parentheses are removed
(as it happened for WoltLab Suite 5.4).

Insert a newline between the base query and the condition to fix the issue.

Resolves #4078

Co-Authored-By: mutec <mysterycode@mysterycode.de>
wcfsetup/install/files/lib/form/UserSearchForm.class.php

index 72204717680074addffbc9a5fdff0cf4411b28aa..9583b960a35fac33d397d4e778498eb741911887 100644 (file)
@@ -175,7 +175,7 @@ class UserSearchForm extends UserOptionListForm {
                }
                
                // do search
-               $statement = WCF::getDB()->prepareStatement($sql.$this->conditions, $this->maxResults);
+               $statement = WCF::getDB()->prepareStatement($sql."\n".$this->conditions, $this->maxResults);
                $statement->execute($this->conditions->getParameters());
                $this->matches = $statement->fetchAll(\PDO::FETCH_COLUMN);
        }