Fixed #php job.php > Call to a member function run() on null src/XF/Job/MailQueue.php:11

Marcus

Well-known member
Affected version
beta 4
As currently job.php is not executed by javascript with my configuration (https: / http problem) I tried this

#wait -n 20 php job.php

... execute it every 20 seconds. First I got some rounds of "true" responds, but a good time later I took a look at the ongoing execution and that time always received a message like "an unknown error occured" when it should just say "false"

Code:
Error: Call to a member function run() on null src/XF/Job/MailQueue.php:11

#0 src/XF/Job/Manager.php(241): XF\Job\MailQueue->run(3.70423579216)
#1 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 3.70423579216)
#2 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 3.70423579216)
#3 job.php(15): XF\Job\Manager->runQueue(false, 8)
#4 {main}

array(4) {
  ["url"] => string(0) ""
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
I get this error now a lot. I use Amazon SES for sending emails and have not changed any setting.

Code:
Error: Call to a member function run() on null src/XF/Job/MailQueue.php:11

#0 src/XF/Job/Manager.php(241): XF\Job\MailQueue->run(8)
#1 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 8)
#2 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 8)
#3 job.php(15): XF\Job\Manager->runQueue(false, 8)
#4 {main}

array(4) {
  ["url"] => string(8) "/job.php"
  ["referrer"] => bool(false)
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(0) {
  }
}
 
Do you have anything like
PHP:
$config['enableMailQueue'] = false;
in your config.php file?
 
I've made the following change to XF/Job/MailQueue.php:
PHP:
    public function run($maxRunTime)
    {
        if ($queue = $this->app->mailQueue())
        {
            $queue->run($maxRunTime);

            if ($queue->hasMore())
            {
                return $this->resume();
            }
            else
            {
                return $this->complete();
            }
        }
        else
        {
            return $this->complete();
        }
    }
 
Top Bottom