diff --git a/main/inc/lib/database.lib.php b/main/inc/lib/database.lib.php index c3af22e4fa..2d2b76a86f 100644 --- a/main/inc/lib/database.lib.php +++ b/main/inc/lib/database.lib.php @@ -1241,8 +1241,8 @@ class Database { $order_array = $condition_data; if (!empty($order_array)) { - if (count($order_array) >= 1 && !empty($order_array[0])) { - $order_array = self::escape_string($order_array[0]); + if (is_array($order_array) && count($order_array) >= 1 && !empty($order_array[0])) { + $order_array = self::escape_string($order_array[0]); $new_order_array = explode(',', $order_array); diff --git a/main/inc/lib/database.mysqli.lib.php b/main/inc/lib/database.mysqli.lib.php index fd4564b791..6ad133b4a4 100644 --- a/main/inc/lib/database.mysqli.lib.php +++ b/main/inc/lib/database.mysqli.lib.php @@ -1159,7 +1159,7 @@ class Database { $order_array = $condition_data; if (!empty($order_array)) { - if (count($order_array) >= 1 && !empty($order_array[0])) { + if (is_array($order_array) && count($order_array) >= 1 && !empty($order_array[0])) { $order_array = self::escape_string($order_array[0]); $new_order_array = explode(',', $order_array);