From 1336c8ebcaf4bc812324ab3860e9d92d3ca32096 Mon Sep 17 00:00:00 2001 From: mudrd8mz Date: Tue, 22 Sep 2009 21:03:38 +0000 Subject: [PATCH] MDL-20334 get_in_or_equal() does not accept empty array --- lib/dml/moodle_database.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index 07d08763c0..8eb5891243 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -522,6 +522,9 @@ abstract class moodle_database { * @return array - $sql and $params */ public function get_in_or_equal($items, $type=SQL_PARAMS_QM, $start='param0000', $equal=true) { + if (empty($items) and is_array($items)) { + throw new coding_exception('moodle_database::get_in_or_equal() does not accept empty arrays'); + } if ($type == SQL_PARAMS_QM) { if (!is_array($items) or count($items) == 1) { $sql = $equal ? '= ?' : '<> ?'; -- 2.39.5