From 44f6ca9e11a8c4e8540cbde03d8e63aaa8bff15d Mon Sep 17 00:00:00 2001 From: mudrd8mz Date: Tue, 22 Sep 2009 21:18:29 +0000 Subject: [PATCH] MDL-20334 re-fix - small performance improvement As Petr suggested, is_array() is faster than empty() so it makes sense to check it first. --- lib/dml/moodle_database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dml/moodle_database.php b/lib/dml/moodle_database.php index 8eb5891243..50c453729a 100644 --- a/lib/dml/moodle_database.php +++ b/lib/dml/moodle_database.php @@ -522,7 +522,7 @@ 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)) { + if (is_array($items) and empty($items)) { throw new coding_exception('moodle_database::get_in_or_equal() does not accept empty arrays'); } if ($type == SQL_PARAMS_QM) { -- 2.39.5