Fixed [E_NOTICE] Trying to get property of non-object and Argument 2 passed ERROR

Affected version
2

reddit.

New member
ONE ERROR

Code:
ErrorException: [E_NOTICE] Trying to get property of non-object src/XF/Repository/UserUpgrade.php:122



#0 src/XF/Repository/UserUpgrade.php(122): XF::handlePhpError(8, '[E_NOTICE] Tryi...', '/home/r/rangrou...', 122, Array)

#1 src/XF/Cron/CleanUp.php(169): XF\Repository\UserUpgrade->downgradeExpiredUpgrades()

#2 [internal function]: XF\Cron\CleanUp::runUserDowngrade(Object(XF\Entity\CronEntry))

#3 src/XF/Job/Cron.php(35): call_user_func(Array, Object(XF\Entity\CronEntry))

#4 src/XF/Job/Manager.php(241): XF\Job\Cron->run(8)

#5 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 8)

#6 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 8)

#7 job.php(15): XF\Job\Manager->runQueue(false, 8)

#8 {main}



array(4) {

  ["url"] => string(8) "/job.php"

  ["referrer"] => string(29) "https://mysite.com/members/"

  ["_GET"] => array(0) {

  }

  ["_POST"] => array(0) {

  }

}
TWO ERROR

Code:
TypeError: Argument 2 passed to XF\Service\User\Downgrade::__construct() must be an instance of XF\Entity\UserUpgrade, null given, called in /public_html/src/XF/Container.php on line 276 src/XF/Service/User/Downgrade.php:29

#0 src/XF/Container.php(276): XF\Service\User\Downgrade->__construct(Object(XF\Pub\App), NULL, Object(XF\Entity\User), Object(XF\Entity\UserUpgradeActive))

#1 src/XF/App.php(1318): XF\Container->createObject('XF\\Service\\User...', Array)

#2 src/XF/Container.php(228): XF\App->XF\{closure}('XF\\Service\\User...', Array, Object(XF\Container))

#3 src/XF/App.php(2456): XF\Container->create('service', 'XF:User\\Downgra...', Array)

#4 src/XF/Repository/UserUpgrade.php(132): XF\App->service('XF:User\\Downgra...', NULL, Object(XF\Entity\User), Object(XF\Entity\UserUpgradeActive))

#5 src/XF/Cron/CleanUp.php(169): XF\Repository\UserUpgrade->downgradeExpiredUpgrades()

#6 [internal function]: XF\Cron\CleanUp::runUserDowngrade(Object(XF\Entity\CronEntry))

#7 src/XF/Job/Cron.php(35): call_user_func(Array, Object(XF\Entity\CronEntry))

#8 src/XF/Job/Manager.php(241): XF\Job\Cron->run(8)

#9 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 8)

#10 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 8)

#11 job.php(15): XF\Job\Manager->runQueue(false, 8)

#12 {main}



array(4) {

  ["url"] => string(8) "/job.php"

  ["referrer"] => string(29) "https://mysite.com/members/"

  ["_GET"] => array(0) {

  }

  ["_POST"] => array(0) {

  }

}
 

Chris D

XenForo developer
Staff member
I think this is a situation where you have active upgrades which relate to user upgrades that no longer exist.

We'll need to attempt to handle that more elegantly.
 

BegemotUral

Active member
The error cycle is an hour
Remove the user record from the table xf_user_upgrade_active. In past promotions it will not, but this is not critical.
Удалите запись о проблемном пользователе из таблицы xf_user_upgrade_active. В истекших повышениях его не будет, но это и не критично.
 

reddit.

New member
Remove the user record from the table xf_user_upgrade_active. In past promotions it will not, but this is not critical.
Удалите запись о проблемном пользователе из таблицы xf_user_upgrade_active. В истекших повышениях его не будет, но это и не критично.
Problem solved
 

Slavik

XenForo moderator
Staff member
Re opening this as we seem to have found another case of it happening:

Clicking the 'downgrade' link under the 'extra' tab when editing a user, that case was probably never covered in the original fix.
 

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XF release (2.1.3).

Change log:
Hide active/expired upgrades if their parent upgrade has been deleted in more cases.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 

Davey-UK

Active member
Just has this happen to us. We no longer have an active upgrade for reccurring payments, but one has just been paid through paypal automatic payments. (Obviously still running in paypal) The subscription has been cancelled by the user just after this payment. Now we have the same error.
I am going to downgrade the user manually, but just giving an insight as to why the error is being logged.
 
Top