]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14679 detect incorrect key=>value pairs in $conditions - in case somebody forgets...
authorskodak <skodak>
Fri, 30 May 2008 16:56:43 +0000 (16:56 +0000)
committerskodak <skodak>
Fri, 30 May 2008 16:56:43 +0000 (16:56 +0000)
lib/dml/moodle_database.php

index 85e7289dd143a03ee7556d694d656747330f27c0..f7bb9c4b6f94ae4d311de53778373674ca308119 100644 (file)
@@ -1187,6 +1187,11 @@ abstract class moodle_database {
      */
     public abstract function sql_substr();
 
+    /**
+     * Returns SQL WHERE conditions
+     * @param array conditions - must not contain numeric indexes
+     * @return array sql part and params 
+     */
     public function where_clause(array $conditions=null) {
         $allowed_types = $this->allowed_param_types();
         if (empty($conditions)) {
@@ -1195,6 +1200,9 @@ abstract class moodle_database {
         $where = array();
         $params = array();
         foreach ($conditions as $key=>$value) {
+            if (is_int($key)) {
+                error('$conditions array may not contain numeric keys, please fix the code!');
+            }
             if (is_null($value)) {
                 $where[] = "$key IS NULL";
             } else {