XF 2.0 Unknown user ruined my upgrades

Fattycakez1

Active member
Hi

This Unknown user never expire and it bugged my other upgrades so let's say your ugprade ends today , it will not because of this Unknown user

And server error logs

Code:
TypeError: Argument 3 passed to XF\Service\User\Downgrade::__construct() must be an instance of XF\Entity\User, null given, called in /home/public_html/src/XF/Container.php on line 270 src/XF/Service/User/Downgrade.php:29
Generated by: xMidNight Jun 11, 2020 at 10:29 AM
Stack trace
#0 src/XF/Container.php(270): XF\Service\User\Downgrade->__construct(Object(XF\Admin\App), Object(NF\GiftUpgrades\XF\Entity\UserUpgrade), NULL)
#1 src/XF/App.php(1570): XF\Container->createObject('NF\\GiftUpgrades...', Array)
#2 src/XF/Container.php(228): XF\App->XF\{closure}('NF\\GiftUpgrades...', Array, Object(XF\Container))
#3 src/XF/App.php(2776): XF\Container->create('service', 'XF:User\\Downgra...', Array)
#4 [internal function]: XF\App->service('XF:User\\Downgra...', Object(NF\GiftUpgrades\XF\Entity\UserUpgrade), NULL)
#5 src/XF/Mvc/Controller.php(738): call_user_func_array(Array, Array)
#6 src/XF/Admin/Controller/UserUpgrade.php(338): XF\Mvc\Controller->service('XF:User\\Downgra...', Object(NF\GiftUpgrades\XF\Entity\UserUpgrade), NULL)
#7 src/addons/SV/ExpiringUserUpgrades/XF/Admin/Controller/UserUpgrade.php(46): XF\Admin\Controller\UserUpgrade->actionDowngrade()
#8 src/XF/Mvc/Dispatcher.php(350): SV\ExpiringUserUpgrades\XF\Admin\Controller\UserUpgrade->actionDowngrade(Object(XF\Mvc\ParameterBag))
#9 src/XF/Mvc/Dispatcher.php(261): XF\Mvc\Dispatcher->dispatchClass('XF:UserUpgrade', 'Downgrade', Object(XF\Mvc\RouteMatch), Object(SV\ExpiringUserUpgrades\XF\Admin\Controller\UserUpgrade), NULL)
#10 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\ExpiringUserUpgrades\XF\Admin\Controller\UserUpgrade), NULL)
#11 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#12 src/XF/App.php(2184): XF\Mvc\Dispatcher->run()
#13 src/XF.php(391): XF\App->run()
#14 admin.php(13): XF::runApp('XF\\Admin\\App')
#15 {main}

I found him in my active user upgrades but i couldn't downgrade him what can i do?
 
You somehow appear to have an active user upgrade record for a user that has been deleted. I'm not entirely sure how as I have checked our code and we do clean this up, so this shouldn't be possible.

Unfortunately, that means that this record would need to be deleted manually from the database. If you're comfortable doing this, it would be in the xf_user_upgrade_active table. When you look at the "downgrade" link, you'll see user_upgrade_record_id=### in the link; this is the entry you'd need to remove from that table. (We'd always recommend taking a backup before doing anything to the DB!)

If you aren't comfortable with this and you have something like phpMyAdmin available, submit a ticket with ACP access details and phpMyAdmin/DB admin access details, and tell us how to find the problematic upgrade record in the ACP and we can remove it for you.
 
You somehow appear to have an active user upgrade record for a user that has been deleted. I'm not entirely sure how as I have checked our code and we do clean this up, so this shouldn't be possible.

Unfortunately, that means that this record would need to be deleted manually from the database. If you're comfortable doing this, it would be in the xf_user_upgrade_active table. When you look at the "downgrade" link, you'll see user_upgrade_record_id=### in the link; this is the entry you'd need to remove from that table. (We'd always recommend taking a backup before doing anything to the DB!)

If you aren't comfortable with this and you have something like phpMyAdmin available, submit a ticket with ACP access details and phpMyAdmin/DB admin access details, and tell us how to find the problematic upgrade record in the ACP and we can remove it for you.
Got it, Thank you so much

My current xenforo version is 2.1.7 i'm not sure how this happened , Been 3 days and i'm wondering why no one is expiring

But i did find his user_id it was 220 and i deleted this user like 2 weeks ago not sure how it reflected now.
 
@Mike

It seems like there's another error related to this downgrade stuff by an unknown user


  • Code:
    TypeError: Argument 3 passed to XF\Service\User\Downgrade::__construct() must be an instance of XF\Entity\User, null given, called in /home/public_html/src/XF/Container.php on line 270 src/XF/Service/User/Downgrade.php:29
    Generated by: Unknown account Jun 19, 2020 at 7:50 PM
Error title ^^

Code:
Stack trace
#0 src/XF/Container.php(270): XF\Service\User\Downgrade->__construct(Object(XF\Pub\App), Object(NF\GiftUpgrades\XF\Entity\UserUpgrade), NULL, Object(NF\GiftUpgrades\XF\Entity\UserUpgradeActive))
#1 src/XF/App.php(1570): XF\Container->createObject('NF\\GiftUpgrades...', Array)
#2 src/XF/Container.php(228): XF\App->XF\{closure}('NF\\GiftUpgrades...', Array, Object(XF\Container))
#3 src/XF/App.php(2776): XF\Container->create('service', 'XF:User\\Downgra...', Array)
#4 src/XF/Repository/UserUpgrade.php(141): XF\App->service('XF:User\\Downgra...', Object(NF\GiftUpgrades\XF\Entity\UserUpgrade), NULL, Object(NF\GiftUpgrades\XF\Entity\UserUpgradeActive))
#5 src/addons/SV/ExpiringUserUpgrades/XF/Repository/UserUpgrade.php(45): XF\Repository\UserUpgrade->downgradeExpiredUpgrades()
#6 src/XF/Cron/CleanUp.php(183): SV\ExpiringUserUpgrades\XF\Repository\UserUpgrade->downgradeExpiredUpgrades()
#7 [internal function]: XF\Cron\CleanUp::runUserDowngrade(Object(XF\Entity\CronEntry))
#8 src/XF/Job/Cron.php(35): call_user_func(Array, Object(XF\Entity\CronEntry))
#9 src/XF/Job/Manager.php(253): XF\Job\Cron->run(G)
#10 src/XF/Job/Manager.php(195): XF\Job\Manager->runJobInternal(Array, G)
#11 src/XF/Job/Manager.php(79): XF\Job\Manager->runJobEntry(Array, G)
#12 job.php(42): XF\Job\Manager->runQueue(false, 8)
#13 {main}


Is there's something wrong with my ugprades system?

I tried to find the "unknown user" in my upgrades but i couldn't 8k of expired upgrades... What should i do :(
 
Last edited:
This is basically the same issue as before and the resolution would be the same thing.

Note that you're not looking at expired user upgrades -- you're looking at active ones. And notably, you're likely looking at the one with the "oldest" expiry date (at this point, it'd be in the past).
 
This is basically the same issue as before and the resolution would be the same thing.

Note that you're not looking at expired user upgrades -- you're looking at active ones. And notably, you're likely looking at the one with the "oldest" expiry date (at this point, it'd be in the past).

Gotcha, The last time i did it , I'm 100% sure i deleted it and i checked many times

And it came back after few days , But i guess i'm too dumb to realise it's the same error ..

I'm wondering if someone found a security bug which causes this, Because when i deleted it once again it's the same exact number as before when i deleted it in database.
 
If it's coming up with the same user_upgrade_record_id value each time, then that would seem to indicate that the record isn't actually being deleted from the database (and thus the problem is not being fixed). There isn't any reason for that to come back.
 
I just had this same problem. It turns out in the end, there were a total of 15 deleted people with an active subscription. How or why, I don't know.

The query to identify these accounts was
Code:
SELECT a.*, b.user_id FROM `xf_user_upgrade_active` AS a
LEFT JOIN xf_user AS b ON a.user_id = b.user_id
HAVING b.user_id IS NULL

I then went through each user_upgrade_record_id entry and deleted it manually. You can do this automatically with a more difficult SQL query, but it inspired more confidence done manually, lol.
 
I just had this same problem. It turns out in the end, there were a total of 15 deleted people with an active subscription. How or why, I don't know.

The query to identify these accounts was
Code:
SELECT a.*, b.user_id FROM `xf_user_upgrade_active` AS a
LEFT JOIN xf_user AS b ON a.user_id = b.user_id
HAVING b.user_id IS NULL

I then went through each user_upgrade_record_id entry and deleted it manually. You can do this automatically with a more difficult SQL query, but it inspired more confidence done manually, lol.
This was a lifesaver for me! Our forums are 22 years old. Recently. I went through via MYSQL and manually wiped out all user accounts that had ever posted anything or logged in years. Apparently, a lot of them were paid members, which is surprising. Was going through cross-checking them all and then found this post and bam! Problem solved.

The only thing, I didn't read where you said you manually deleted the results from the query, but I checked the ones that were returned and sure enough, that was them and deleted them.

Thanks again!


46-records.webp
 
Recently. I went through via MYSQL and manually wiped out all user accounts that had ever posted anything or logged in years.
Why would you do that?

The database should never be manually edited as it risks orphaned data.

There are tools in the ACP for pruning content.
 
Why would you do that?
There are tools in the ACP for pruning content.
There are now, but once upon a time, there were not. :) Keep in mind, I've had this site going since 2001. When you run three different companies, have acting gigs on top of that, it's hard to keep up with stuff. Now I know. :)

Typically since the users in question had never even posted, there was little chance for any impact, but I forgot to factor in people that would buy a membership, yet never post.

On a good, note this hard-deleted it all instead of a soft-delete.
 
Back
Top Bottom