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

reddit.

New member
Affected version
2
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) {

  }

}
 
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.
 
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. В истекших повышениях его не будет, но это и не критично.
 
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
 
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.
 
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.
 
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.
 
I'm having this issue with a "Unknown User" (probably a deleted member), but each hour i get the error:

Code:
TypeError: Argument 3 passed to XF\Service\User\Downgrade::__construct() must be an instance of XF\Entity\User, null given, called in /home/politz/domains/forum.politz.com.br/public_html/src/XF/Container.php on line 275 in src/XF/Service/User/Downgrade.php at line 29
 XF\Service\User\Downgrade->__construct() in src/XF/Container.php at line 275
 XF\Container->createObject() in src/XF/App.php at line 1564
 XF\App->XF\{closure}() in src/XF/Container.php at line 228
 XF\Container->create() in src/XF/App.php at line 2770
 XF\App->service()
 call_user_func_array() in src/XF/Mvc/Controller.php at line 738
 XF\Mvc\Controller->service() in src/XF/Admin/Controller/UserUpgrade.php at line 338
 XF\Admin\Controller\UserUpgrade->actionDowngrade() in src/XF/Mvc/Dispatcher.php at line 321
 XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 244
 XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
 XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
 XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2178
 XF\App->run() in src/XF.php at line 390
 XF::runApp() in admin.php at line 13

If i try to manually downgrade the "Unknown User", i get this error too.

Can i just remove this directly from the database? Where i have to look?

Thanks guys.
 
Top Bottom