Page 1 of 1

Paypal error

Posted: Fri Jan 06, 2023 8:00 pm
by Omar_one
Hello,
I just check our error_log file and find this errors (1.0.8.16 PRO and the paypal module from the pro folder)

Code: Select all

PHP Notice:  Undefined index: pending_reason in /home/XXXX/public_html/includes/modules/payment/paypal_standard.php on line 616
PHP Notice:  Undefined variable: customer in /home/XXXX/public_html/ext/modules/payment/paypal/standard_ipn.php on line 62
Thank you in advance
Omar

Re: Paypal error

Posted: Sat Jan 07, 2023 5:34 pm
by ecartz
If you change that line 62 (path given in the notice) from

Code: Select all

    if (!($customer instanceof customer) || ($customer_id != $customer->get_id())) {
to either

Code: Select all

    if (!(($customer ?? null) instanceof customer) || ($customer_id != $customer->get_id())) {
or

Code: Select all

    if (!isset($customer) || !($customer instanceof customer) || ($customer_id != $customer->get_id())) {
That notice would go away. That notice is pretty harmless anyway, but a PHP update might change it to a warning or fatal.

For the other one, you could suppress the notice by changing line 616 to

Code: Select all

                          . 'Pending Reason: ' . htmlspecialchars($pptx_params['pending_reason'] ?? '');
I.e. add ?? '' to it. It's not clear to me if that is a real problem or PayPal just doesn't always send that. Presumably BrockleyJohn's version won't have that problem.

Re: Paypal error

Posted: Sat Jan 07, 2023 6:50 pm
by Omar_one
thank you @ecartz
I will edit the lines as you post it, I will check also BrockleyJohn's version

Br
Omar