Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-83094

Persistent error when sortorder or descriptionformat for customfield is NULL

XMLWordPrintable

      It's currently possible to set the fields "sortorder" and "descriptionformat" in mdl_customfield_field" and "mdl_customfield_category" to NULL. This happened for me when I installed 3rd party plugins in Moodle that add custom fields.
      When either "sortorder" and/or "descriptionformat" is NULL, I'm getting the following error (Moodle 4.1):

      Stacktrace (Moodle 4.1.13)

      sortorder: Data submitted is invalid
      Error code: invalidpersistenterror

      • line 558 of /lib/classes/persistent.php: core\invalid_persistent_exception thrown
      • line 607 of /lib/classes/persistent.php: call to core\persistent->update()
      • line 194 of /customfield/classes/field_controller.php: call to core\persistent->save()
      • line 200 of /customfield/classes/api.php: call to core_customfield\field_controller->save()
      • line 324 of /customfield/classes/handler.php: call to core_customfield\api::move_field()
      • line 250 of /customfield/externallib.php: call to core_customfield\handler->move_field()
      • line 262 of /lib/externallib.php: call to core_customfield_external::move_field()
      • line 81 of /lib/ajax/service.php: call to external_api::call_external_function()

      I can reproduce this error in Moodle 4.1 and also in current dev version of 4.5. In my opinion, the either the database fields should've set to either "NOT NULL" or NULL values should be handled on PHP side instead of throwing an error.

            pholden Paul Holden
            mstimvol Tim Volckmann
            Carlos Castillo Carlos Castillo
            Andrew Lyons Andrew Lyons
            CiBoT CiBoT
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 31 minutes
                2h 31m

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