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

Areas created via IMS Enterprise return NULL instead of 'Blank' in Moodle 4

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.1.4
    • General
    • MOODLE_401_STABLE
    • MDL-79026-403
    • MDL-79026-404
    • MDL-79026-main
    • Hide
      1. Run the Enrolment file processing cron (IMS Enterprise file), that creates the required Moodle areas (and possibly enrolments).
      2. Assign a user with a Teacher role (e.g. Tutor A) in the newly created area (unless this was assigned automatically during step 1).
      3. Log in using the 'Tutor A' credentials and access the newly created Moodle area.
      4. Access the Settings page of the Moodle area.
        The error:
        Exception - Return value of MoodleQuickForm_editor::get_text() must be of the type string, null returned
        is encountered.
      5. Log out and log in using an admin account.
      6. Access the newly created area in step 1.
      7. Access the Settings page of the Moodle area.
        The Settings page is displayed successfully and the value within the database is now updated from 'NULL' to 'Blank'.
      8. Log out and log in again using 'Tutor A' credentials.
      9. Access the Moodle area created in step 1.
      10. Access the Settings page of the Moodle area.
        Tuto A can now access the Settings page successfully.
      Show
      Run the  Enrolment file processing cron (IMS Enterprise file), that creates the required Moodle areas (and possibly enrolments). Assign a user with a Teacher role (e.g. Tutor A) in the newly created area (unless this was assigned automatically during step 1). Log in using the 'Tutor A' credentials and access the newly created Moodle area. Access the  Settings page of the Moodle area. The error: Exception - Return value of MoodleQuickForm_editor::get_text() must be of the type string, null returned is encountered. Log out and log in using an admin account. Access the newly created area in step 1. Access the  Settings page of the Moodle area. The  Settings page is displayed successfully and the value within the database is now updated from 'NULL' to 'Blank'. Log out and log in again using 'Tutor A' credentials. Access the Moodle area created in step 1. Access the  Settings page of the Moodle area. Tuto A can now access the  Settings  page successfully.

      Following an upgrade from version 3.9 to 4.1, our users reported that they could no longer access a course 'Settings' page as the following error is displayed:

      Exception - Return value of MoodleQuickForm_editor::get_text() must be of the type string, null returned

      More information about this error

      More information gives the following:

      error/moodle/generalexceptionmessage

      Jump to:navigationsearch

      A general error occurred (sorry we can't be more helpful here!)

      You could try copying the text that was shown and doing a web search with it.

      In Moodle 4.x this error might be caused by trying to use a 'draft' question in a quiz. Check the question bank!

       

      We realised that the get_text(), which was introduced in Moodle 4, was retrieving a NULL for all course areas which were created via the IMS Enterprise plugin and had the Summary set as blank (Leave it empty).

      For the courses created via IMS Enterprise, we have now modified the file as follows:
      lib/form/editor.php
      Function
      public function get_text()
       
          /**
           * Returns editor text content
           *
           * @return string Text content
           */
          public function get_text(): string {
                 $text = $this->_values['text'];
                 if ( $text === NULL )

      {                    $text = "";            }

                 return $text;
          }

       

      For reference, we have Moodle 4.1.4 (Build: 20230612).

       

      This was also reported on the Moodle Community fora:

      https://moodle.org/mod/forum/discuss.php?d=447678

            lucaboesch Luca Bösch
            lullaby246 Naomi Mifsud
            Votes:
            6 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:

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