Plugin has 4x undefined index

I get 4x undefined index in the paypal-utilities file.


Also posted on Github.

I think this can be prevented by changing

if(!$response["ACK"] || !preg_match("/^(Success|SuccessWithWarning)$/i", $response["ACK"]))


if(! isset( $response["ACK"] ) || !preg_match("/^(Success|SuccessWithWarning)$/i", $response["ACK"]))

After changing it the undefined indexes are gone.

Hi Berry.

Thanks for reporting that. I had not seen it mentioned before. Was it with a normal transaction, or did you try the return URL without having done a payment with PayPal (resulting in missing return vars). What were the steps to reproduce it?

About the errors, could you try changing those lines to these ?

						if(!isset($response["ACK"]) || !preg_match("/^(Success|SuccessWithWarning)$/i", $response["ACK"]))
								if(!empty($response["L_ERRORCODE0"]) || !empty($response["L_SHORTMESSAGE0"]) || !empty($response["L_LONGMESSAGE0"]))

Thanks :slight_smile:

TBH I don’t recall :slight_smile: It’s been a while…

I would have to do some testing. I think I changed it to what I wrote above, but will change your suggestion and see if any errors come up…

1 Like