1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Bounced Mail Cron returns Call_User_Func ACP error

Discussion in 'XenForo Development Discussions' started by Marcus, Nov 2, 2013.

  1. Marcus

    Marcus Well-Known Member

    Do you know what causes this error, usually the addon works fine:
    PHP:
    XenForo_Model::create('BouncedMail_Model_BouncedMail')->updateBouncedUsers($bouncedMails);
    PHP:
    class BouncedMail_Model_BouncedMail extends XenForo_Model
    {
      public function 
    updateBouncedUsers($bouncedMails)
      {
      return 
    $this->_getDb()->query('
    PHP:
    ErrorExceptioncall_user_func() expects parameter 1 to be a valid callbacknon-static method BouncedMail_BouncedMail::updateBouncedUsers() should not be called statically library/XenForo/Model/Cron.php:356

    #0 [internal function]: XenForo_Application::handlePhpError(2048, 'call_user_func(...', '/usr/local/lsws...', 356, Array)
    #1 /library/XenForo/Model/Cron.php(356): call_user_func(Array, Array)
    #2 /library/XenForo/Deferred/Cron.php(24): XenForo_Model_Cron->runEntry(Array)
    #3 /library/XenForo/Model/Deferred.php(208): XenForo_Deferred_Cron->execute(Array, Array, 9.9999980926514, '')
    #4 /library/XenForo/Model/Deferred.php(331): XenForo_Model_Deferred->runDeferred(Array, 9.9999980926514, '', false)
    #5 /library/XenForo/Model/Deferred.php(284): XenForo_Model_Deferred->_runInternal(Array, NULL, '', false)
    #6 /deferred.php(18): XenForo_Model_Deferred->run(false)
    #7 {main}


    array(3) {
      [
    "url"] => string(37"deferred.php"
      
    ["_GET"] => array(0) {
      }
      [
    "_POST"] => array(4) {
        [
    "_xfRequestUri"] => string(21"..."
        
    ["_xfNoRedirect"] => string(1"1"
        
    ["_xfToken"] => string(8"********"
        
    ["_xfResponseType"] => string(4"json"
      
    }
    }
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    The class names you posted don't match. The error doesn't include the model in the name. That would be the first fix I attempt.
     
  3. Marcus

    Marcus Well-Known Member

    The Class I call in the cron is
    PHP:
    class BouncedMail_BouncedMail
    {
      public function 
    updateBouncedUsers()
      {
    The script does work, but I did get the error messages. I wonder why.
     
  4. xf_phantom

    xf_phantom Well-Known Member

    You've set BouncedMail_Model_BouncedMail::updateBouncedUsers as cronjob?;)

    You need an extrascript, which calls
    PHP:
    XenForo_Model::create('BouncedMail_Model_BouncedMail')->updateBouncedUsers($bouncedMails);
     
    Marcus likes this.
  5. Marcus

    Marcus Well-Known Member

    Oh I have two scripts:

    PHP:
    class BouncedMail_BouncedMail // I call this script in the cron
    {
      public function 
    updateBouncedUsers()
      {
      
    /* magic */
      
    XenForo_Model::create('BouncedMail_Model_BouncedMail')->updateBouncedUsers($bouncedMails);

      }
    }
    PHP:
    <?php

    class BouncedMail_Model_BouncedMail extends XenForo_Model
    {
      public function 
    updateBouncedUsers($bouncedMails)
      {
      return 
    /*query*/
       
    }
    }
     
  6. xf_phantom

    xf_phantom Well-Known Member

    The callback method needs to be static
     
    digitalpoint and Marcus like this.
  7. Marcus

    Marcus Well-Known Member

    Thank you so much !
     

Share This Page