-
Sub-task
-
Resolution: Cannot Reproduce
-
Blocker
-
2.0
-
None
-
MOODLE_20_STABLE
-
MOODLE_20_STABLE
Try to add a new field called questiondecimalpoints int(4) signed not null default -1 with comment "The number of decimal digits to use when displaying question grades. -1 = use decimalpoints, otherwise a separate setting."
I get the error:
Fatal error: Call to a member function getHash() on a non-object in /home/tim/Workspace/moodle_head/admin/xmldb/actions/edit_field_save/edit_field_save.class.php on line 109
This is becuase XMLDB is trying to get the old hash of the field, so it can later see if anything has changed. However, the previous line $table->getField returns NULL, since this is a new field that was not present in the old structure.
Strangely, this code has not changed since it was added to core in August 2006: http://cvs.moodle.org/moodle/admin/xmldb/actions/edit_field_save/edit_field_save.class.php?hideattic=0&revision=1.1&view=markup
Similarly, the method table->getField, although it has moved several times, has not changed at all: http://cvs.moodle.org/moodle/lib/xmldb/classes/XMLDBTable.class.php?hideattic=0&revision=1.22&view=markup, and it has always returned null in this situation.
So, how the hell did it ever used to work. More to the point, why is it that every time I try to use XMLDB, it seems like I have to fix some bugs in it first?
/me goes to edit the XML by hand and swear and curse about the stupid, unnecessary, prev and next attributes.