moodleou / moodle-mod_forumng

ForumNG forum module for Moodle
19 stars 20 forks source link

PHP 5.4 fixes #6

Closed markward closed 11 years ago

markward commented 11 years ago

Declare $FORUMNG_CACHE as new stdclass if it isn't an object yet.

sammarshallou commented 11 years ago

Will leave it to Jason, but just to comment, I think this change should go in the existing if statement just below rather than making a new if statement.

markward commented 11 years ago

Yes, I think that would probably make sense :)

jason-platts commented 11 years ago

Mark, I'm not understanding the issue here.

Are you saying $FORUMNG_CACHE gets set to a non-object somewhere and thus needs to be cleared?

Because the isset check below should be picking up when it either isn't set or is null already...

markward commented 11 years ago

On PHP 5.4 you cannot use refer to an object before it has been declared or you get a warning:

"Warning: Creating default object from empty value in \mod\forumng\mod_forumng.php on line 1867"

So you just need to add "$FORUMNG_CACHE = new stdclass();" before "$FORUMNG_CACHE->subscriptioninfo = array();"

markward commented 11 years ago

Never mind, I must be running code from Moodle.org on my install since I just checked the version here and realised you have already corrected it. Sorry for the confusion.