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

Can't subscribe other user to forum

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.1.7, 2.2.4
    • Component/s: Forum
    • Labels:

      Description

      If you attempt to subscribe another user to a forum you produce the following stack trace:
      Debug info: Column 'userid' cannot be null
      INSERT INTO mdl_forum_subscriptions (userid,forum) VALUES(?,?)
      [array (
      0 => NULL,
      1 => '2',
      )]
      Error code: dmlwriteexception
      Stack trace:
      line 416 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 952 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 994 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw()
      line 4560 of /mod/forum/lib.php: call to mysqli_native_moodle_database->insert_record()
      line 170 of /mod/forum/subscribe.php: call to forum_subscribe()
      Output buffer: <br /> <b>Notice</b>: Undefined property: stdClass::$id in <b>/html/mod/forum/subscribe.php</b> on line <b>134</b><br /> <br /> <b>Notice</b>: Undefined property: stdClass::$id in <b>/html/mod/forum/subscribe.php</b> on line <b>170</b><br />

      The $DB->get_record() call on line 65 includes only three parameters, so it never returns any fields. I'm not sure how to actually reach this code via the interface; I noticed the function call and worked backwards to produce the stack trace.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

              Hide
              samhemelryk Sam Hemelryk added a comment -

              Good catch thanks Charles! Fix looks spot on, integrator this needs to be backported to 21 as well.

              Cheers
              Sam

              Show
              samhemelryk Sam Hemelryk added a comment - Good catch thanks Charles! Fix looks spot on, integrator this needs to be backported to 21 as well. Cheers Sam
              Hide
              poltawski Dan Poltawski added a comment -

              Thanks Charles, I've integrated this to master, 22 and 21

              Show
              poltawski Dan Poltawski added a comment - Thanks Charles, I've integrated this to master, 22 and 21
              Hide
              fred Frédéric Massart added a comment -

              Test successful on master, 2.2 and 2.1, but I could not find how to reach this page without hacking the URL.

              Charles, could you explain how you reproduced this bug?

              This also raises another issue which I will link to this one.

              Show
              fred Frédéric Massart added a comment - Test successful on master, 2.2 and 2.1, but I could not find how to reach this page without hacking the URL. Charles, could you explain how you reproduced this bug? This also raises another issue which I will link to this one.
              Hide
              cfulton Charles Fulton added a comment -

              I also had to hack the URL, which does make me wonder if this code is even in use.

              Show
              cfulton Charles Fulton added a comment - I also had to hack the URL, which does make me wonder if this code is even in use.
              Hide
              poltawski Dan Poltawski added a comment -

              Congratulations!

              Your work has made into the latest Moodle release!

              You are only authorised to celebrate after testing 15 Moodle 2.3 QA tests, thanks!

              Show
              poltawski Dan Poltawski added a comment - Congratulations! Your work has made into the latest Moodle release! You are only authorised to celebrate after testing 15 Moodle 2.3 QA tests, thanks!

                People

                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    9/Jul/12