From 106ff4708448da7aba1ee13ef3112f26a45f7c16 Mon Sep 17 00:00:00 2001 From: leigh-ols Date: Tue, 6 Jun 2017 17:27:43 +0100 Subject: [PATCH] Fix issue where orderBy strips spaces from fieldname --- MysqliDb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MysqliDb.php b/MysqliDb.php index 19d3d55b..a90e2805 100644 --- a/MysqliDb.php +++ b/MysqliDb.php @@ -1093,7 +1093,7 @@ public function orderBy($orderByField, $orderbyDirection = "DESC", $customFields { $allowedDirection = Array("ASC", "DESC"); $orderbyDirection = strtoupper(trim($orderbyDirection)); - $orderByField = preg_replace("/[^-a-z0-9\.\(\),_`\*\'\"]+/i", '', $orderByField); + $orderByField = preg_replace("/[^ -a-z0-9\.\(\),_`\*\'\"]+/i", '', $orderByField); // Add table prefix to orderByField if needed. //FIXME: We are adding prefix only if table is enclosed into `` to distinguish aliases