Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-19303 META: XMLDB Editor various bugs/improvements
  3. MDL-18497

Cannot add a new field to a table with the XMLDB editor

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Cannot Reproduce
    • Icon: Blocker Blocker
    • 2.0
    • 2.0
    • Database SQL/XMLDB
    • 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.

            stronk7 Eloy Lafuente (stronk7)
            timhunt Tim Hunt
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.