• 0

[php] Fatal error: Call to undefined method stdClass::set()


Question

i am creating a plugin for wordpress and keep getting an error i know nothing about, what does this error mean?

Fatal error: Call to undefined method stdClass::set() in/home/uplift/public_html/forum/includes/functions.php on line 7345

within my plugin it pulls vbulletin forums global.php, which in turn will reference functions.php

if (!defined('LOCATION_BYPASS'))

{
			$vbulletin->session->set('inforum', (!empty($foruminfo['forumid']) ? $foruminfo['forumid'] : 0));
			$vbulletin->session->set('inthread', (!empty($threadinfo['threadid']) ? $threadinfo['threadid'] : 0));
			$vbulletin->session->set('incalendar', (!empty($calendarinfo['calendarid']) ? $calendarinfo['calendarid'] : 0));
}

this line is 7345:

$vbulletin->session->set('inforum', (!empty($foruminfo['forumid']) ? $foruminfo['forumid'] : 0))

can anyone shed any light?

One minute it will work, then it will show this error, logging out of forum and in again fixes it then it breaks again after a while

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

This error usually means the variable/property you're accessing (in this case $vbulletin->session) isn't set, but because you're accessing it as an object, i.e. trying to call methods / access properties on it, PHP converts it to an instance of stdClass which is PHP's standard generic object class.

I don't know VBulletin, but my guess is that when you're referencing $vbulletin->session, the session hasn't actually be initialised yet and you either need to do something to initialise it, or move your code somewhere else, so that when you come to access the session property, the session itself has been successfully initialised.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.