Paypal error

Open to all! Ask other shopowners for help.
Post Reply
Omar_one
Senior Contributor
Posts: 679
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Has thanked: 100 times
Been thanked: 56 times

Paypal error

Post 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


Join The Code Co-op to get access to your library in the Code Co-op Forum
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Paypal error

Post 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.
Omar_one
Senior Contributor
Posts: 679
Joined: Fri Oct 25, 2019 5:06 pm
Phoenix Version: v1.0.8.16
Has thanked: 100 times
Been thanked: 56 times

Re: Paypal error

Post by Omar_one »

thank you @ecartz
I will edit the lines as you post it, I will check also BrockleyJohn's version

Br
Omar


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply