Moodle

Forum email not getting sent after upgrade from 1.8 to 1.9. Looks like bug is in /mod/forum/lib.php in one get_context_instance() call

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Duplicate
  • Affects Version/s: 1.9.3
  • Fix Version/s: None
  • Component/s: Forum
  • Labels:
    None
  • Environment:
    n/a
  • Database:
    MySQL
  • Difficulty:
    Difficult
  • Affected Branches:
    MOODLE_19_STABLE

Description

I have a client site that was upgraded from 1.8.2+ to 1.9.3+. After this upgrade, email is not being sent from forums. Debugging notes:

  • All my other 1.9.3+ sites running the same codebase are sending forum email just fine
  • Email for the rest of the site works fine (e.g. Messaging, self-enrollment)

I get an error, with debug set to all, as follows:

Catchable fatal error</b>: Object of class stdClass could not be converted to string in <b>/path/to/moodle/lib/dmllib.php</b> on line <b>2219</b>
// (the line number might be incorrect!!)

That error is within the function where_clause() which expects only string value params.

It turns out that on approximately line 292 of /mod/forum/lib.php, there is a call to get_context_instance() as follows:

...
if ($subusers = forum_subscribed_users($courses[$courseid], $forums[$forumid], 0,
get_context_instance(CONTEXT_MODULE, $coursemodules[$forumid]->instance))) { // THIS IS THE LINE
foreach ($subusers as $postuser) {
...

But $coursemodules[$forumid] on that line is an Object and the where_clause() poops out because of it.

I haven't as yet tracked down a fix; I also haven't tracked down the ultimate cause. Also, since 1.9.3+ sites on the same codebase are sending email fine, I 'm reasonably sure that the upgrade is the root of the problem somewhere.

I'll report back more details as I get them. Thank you!

Issue Links

Activity

Hide
Martin Dougiamas added a comment -

Hi, can you make sure you are using a recent weekly version? I think this regression was fixed shortly before Xmas.

Show
Martin Dougiamas added a comment - Hi, can you make sure you are using a recent weekly version? I think this regression was fixed shortly before Xmas.
Hide
Jeffrey Silverman added a comment -

Thanks. I am using version as follows:

$version = 2007101532.11; // YYYYMMDD = date of the 1.9 branch (don't change)
$release = '1.9.3+ (Build: 20081216)'; // Human-friendly version name

(I guess WEEKLY is "Build: 20090114" or somesuch?)

Due to the way we host Moodle, I may not be able to get the weekly latest out immediately to my clients. However, I do think I can apply a small patch. Is there another Tracker issue that references this bugfix? And/or is there a specific description of the fix so I can apply it?

Thanks!

Show
Jeffrey Silverman added a comment - Thanks. I am using version as follows: $version = 2007101532.11; // YYYYMMDD = date of the 1.9 branch (don't change) $release = '1.9.3+ (Build: 20081216)'; // Human-friendly version name (I guess WEEKLY is "Build: 20090114" or somesuch?) Due to the way we host Moodle, I may not be able to get the weekly latest out immediately to my clients. However, I do think I can apply a small patch. Is there another Tracker issue that references this bugfix? And/or is there a specific description of the fix so I can apply it? Thanks!
Hide
Jeffrey Silverman added a comment -

Never mind; I spoke too soon. A browse of Moodle CVS shows me some of the relevant changes.

Thanks

Show
Jeffrey Silverman added a comment - Never mind; I spoke too soon. A browse of Moodle CVS shows me some of the relevant changes. Thanks
Hide
Jeffrey Silverman added a comment -

Sweet, thanks. I don't know how you find the time for these details, although the 12 (or 15? 16?) hour time difference is confusing and makes it seem like you are a robot that needs no sleep. Hmm...

Show
Jeffrey Silverman added a comment - Sweet, thanks. I don't know how you find the time for these details, although the 12 (or 15? 16?) hour time difference is confusing and makes it seem like you are a robot that needs no sleep. Hmm...

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: