]> git.mjollnir.org Git - moodle.git/commitdiff
Prevent rename_field() to be executed if no full specs of
authorstronk7 <stronk7>
Wed, 24 Jan 2007 17:54:53 +0000 (17:54 +0000)
committerstronk7 <stronk7>
Wed, 24 Jan 2007 17:54:53 +0000 (17:54 +0000)
the original field are provided. MDL-8296

lib/ddllib.php

index affb26a074d177f9401a0dec6db5ae52215a4c25..34a168cb941f420d0381b9d3acbd0950004c39e9 100644 (file)
@@ -896,6 +896,12 @@ function rename_field($table, $field, $newname, $continue=true, $feedback=true)
         return false;
     }
 
+/// Check we have included full field specs
+    if (!$field->getType()) {
+        debugging('Field ' . $field->getName() . ' must contain full specs. Rename skipped', DEBUG_DEVELOPER);
+        return false; 
+    }
+
 /// Check field isn't id. Renaming over that field is not allowed
     if ($field->getName() == 'id') {
         debugging('Field ' . $field->getName() . ' cannot be renamed. Rename skipped', DEBUG_DEVELOPER);