Solved Error: Attempt to assign property "uud_id" on null

Smiley

Licensed
Licensed
Upgrade Coupons
User Upgrade Duration
User Upgrade Pro
Joined
Mar 8, 2022
Messages
4
Reaction score
1
Hello, im using UserUpgradeDuration, UserUpgradePro, Upgrade Coupons and NF/Gift Upgrades and i encounter the following issue when the cron job tries to expire user upgrades:

Error: Attempt to assign property "uud_id" on null in src/addons/XenSoluce/UserUpgradeDuration/XF/Repository/UserUpgrade.phpat line 13 #0 src/addons/NF/GiftUpgrades/XF/Repository/UserUpgrade.php(54): XenSoluce\UserUpgradeDuration\XF\Repository\UserUpgrade->expireActiveUpgrade(Object(NF\GiftUpgrades\XF\Entity\UserUpgradeActive), NULL) #1 src/XF/Repository/UserUpgradeRepository.php(162): NF\GiftUpgrades\XF\Repository\UserUpgrade->expireActiveUpgrade(Object(NF\GiftUpgrades\XF\Entity\UserUpgradeActive)) #2 src/XF/Cron/CleanUp.php(246): XF\Repository\UserUpgradeRepository->downgradeExpiredUpgrades() #3 src/XF/Job/Cron.php(42): XF\Cron\CleanUp::runUserDowngrade(Object(XF\Entity\CronEntry)) #4 src/XF/Job/Manager.php(275): XF\Job\Cron->run(8) #5 src/XF/Job/Manager.php(205): XF\Job\Manager->runJobInternal(Array, 8) #6 src/XF/Job/Manager.php(89): XF\Job\Manager->runJobEntry(Array, 8) #7 job.php(46): XF\Job\Manager->runQueue(false, 8) #8 {main}

Addon version:
NF/ Gift Upgrades 2.5.3
User Upgrade Pro 2.1.4 Fix 1
User Upgrade Duration 2.1.2 Fix 6
Upgrade Coupons 2.2.0 Fix 1

I already checked the database and it looks good. I can't see the problem.
I had this issue already with an older version of UUD which i was only able to solve by deinstalling the addon. I hoped it would be fixed after i read the latest changelogs.

This is somewhat urgent as user ugrades are not expiring right now, because the process errors out.

Best regards
 
Hello, i was able to fix this error by modifying the file: src/addons/XenSoluce/UserUpgradeDuration/XF/Repository/UserUpgrade.php

Code:
    public function expireActiveUpgrade(\XF\Entity\UserUpgradeActive $active, \XF\Entity\UserUpgradeExpired $expired = null)
    {
        if ($active->uud_id != 0) 
        {
            if ($expired === null) 
            {
                $expired = $this->em->create('XF:UserUpgradeExpired');
            }
        
            $expired->uud_id = $active->uud_id;
        }
        parent::expireActiveUpgrade($active, $expired);
    }

Best regards
zordem
 
Hello,
i have encountered this issue this time on xenforo 2.3.4.
The time i encountered this issue before it happened on xenforo 2.2.15 (i think).

Best regards
zordem
 
Back
Top Bottom