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

Error when creating new "Simple Single Forum" and Posting from Mobile App - Caused by line 3277 of /mod/forum/lib.php

XMLWordPrintable

    • MOODLE_39_STABLE
    • 1

      WHAT I EXPECTED: The Simple Single Forum to be created and display without errors (when Developer debugging is on)

      WHAT ACTUALLY HAPPENED: An error displays, it seems because the default discussion post had a NULL value for "Attachment" (and possibly some other fields)

      FULL STEPS:

      1. Site Administration > Development > Debugging > Debug messages> set to "DEVELOPER"
      2. Open a test Course.
      3. Turn on Editing
      4. Click add an activity or resource
      5. Click 'Forum'
      6. Add Forum name 'Simple Forum' (or any other name)
      7. Select Forum type "A single simple discussion"
      8. Click "Save and display"
      9. The following error will displayed:

      Simple Forum

      Exception - Argument 12 passed to mod_forum\local\entities\post::__construct() must be of the type boolean, null given, called in [dirroot]/mod/forum/classes/local/factories/entity.php on line 161

      More information about this error

      Debug info:
      Error code: generalexceptionmessage

      Stack trace:

      • line 95 of /mod/forum/classes/local/entities/post.php: TypeError thrown
      • line 161 of /mod/forum/classes/local/factories/entity.php: call to mod_forum\local\entities\post->__construct()
      • line 97 of /mod/forum/classes/local/vaults/post.php: call to mod_forum\local\factories\entity->get_post_from_stdclass()
      • line ? of unknownfile: call to mod_forum\local\vaults\post->mod_forum\local\vaults
        {closure}
        ()
      • line 98 of /mod/forum/classes/local/vaults/post.php: call to array_map()
      • line 160 of /mod/forum/classes/local/vaults/db_table_vault.php: call to mod_forum\local\vaults\post->from_db_records()
      • line 187 of /mod/forum/classes/local/vaults/db_table_vault.php: call to mod_forum\local\vaults\db_table_vault->transform_db_records_to_entities()
      • line 170 of /mod/forum/classes/local/vaults/db_table_vault.php: call to mod_forum\local\vaults\db_table_vault->get_from_ids()
      • line 215 of /mod/forum/view.php: call to mod_forum\local\vaults\db_table_vault->get_from_id()

      Note: If you query the mdl_forum_posts database table of the related discussion for that single discussion forum, the "attachment" field is NULL. But if it is changed to "0", the error disappears and the forum works correctly.

            Unassigned Unassigned
            bradpasley Brad Pasley
            Votes:
            2 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 24 minutes
                24m

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