Fixed 2.2.6 regression: legacy user upgrade payment failure


XenForo developer
Staff member
Affected version
If a PayPal payment is received for a user upgrade subscription that was created in XenForo 1.x, it may fail to process and the following error will be logged in the control panel:

ErrorException: [E_WARNING] Attempt to read property "extra_data" on null src/XF/Purchasable/UserUpgrade.php:50

This error may be logged a number of times for a single payment due to PayPal retrying the IPN callback a number of times.

This issue has been resolved with 2.2.6 Patch 1, but it can be manually resolved by making the following change. In src/XF/Payment/PayPal.php, find:
$state->purchasableHandler = $purchasable->handler;

Immediately after it, add:
return true;

If the error has been received, in most cases, you can update or manually patch the issue and simply wait for PayPal to attempt the callback again. This should allow the payment to go through and be processed successfully.
@Mike I went from 2.2.5 -> 2.2.6 Patch 2 and am getting tons of these errors now. When I opened up PayPal.php it already has return true;
What else has changed in the 2.2.6 P2 version of PayPal.php? Also, can I just download XF 2.2.5 and use that PayPal.php?
Top Bottom