Fixed E_USER_WARNING] Accessed unknown getter 'original_end_date' on XF:UserUpgradeActive[X] in src\XF\Mvc\Entity\Entity.php at line 178

TickTackk

Well-known member
Affected version
2.*
Inside file src\XF\Purchasable\UserUpgrade.php
Find:
PHP:
                    $existingRecord = \XF::em()->find('XF:UserUpgradeActive', $userUpgradeRecordId);
                    if (!$existingRecord)
                    {
                        $existingRecord = \XF::em()->find('XF:UserUpgradeExpired', $userUpgradeRecordId);
                    }
                    if ($existingRecord)
                    {
                        $upgradeService->setEndDate($existingRecord->original_end_date);
                    }
Replace with:
PHP:
                    $existingRecord = \XF::em()->find('XF:UserUpgradeActive', $userUpgradeRecordId);
                    $endDateColumnName = 'end_date';
                    if (!$existingRecord)
                    {
                        $existingRecord = \XF::em()->find('XF:UserUpgradeExpired', $userUpgradeRecordId);
                        $endDateColumnName = 'original_end_date';
                    }
                    if ($existingRecord)
                    {
                        $upgradeService->setEndDate($endDateColumnName);
                    }

Or the end date column always should've been end_date instead? :unsure:
 
Yeah your fix is correct, though the last bit should be similar to:
PHP:
$upgradeService->setEndDate($existingRecord->$endDateColumnName);
Sorted now, cheers.
 
Back
Top Bottom