Tips and Tricks HQ Support Portal › Forums › WP Photo Seller › WPSPayPalStandard.php – secure against null-values
- This topic has 3 replies, 2 voices, and was last updated 6 years, 11 months ago by Peter.
-
AuthorPosts
-
December 2, 2017 at 5:32 pm #14559DesMasMember
Hi
I noticed that in V2.2.8 the PayPal callback can still run into the problem of unexpected null values for the order to be inserted into the table.
Therefore i suggest to secure the data-array:
$data = array(
'bill_first_name' => isset($pp['address_name'])?$pp['address_name']:'',
'bill_address' => isset($pp['address_street'])?$pp['address_street']:'',
'bill_city' => isset($pp['address_city'])?$pp['address_city']:'',
'bill_state' => isset($pp['address_state'])?$pp['address_state']:'',
'bill_zip' => isset($pp['address_zip'])?$pp['address_zip']:'',
'bill_country' => isset($pp['address_country'])?$pp['address_country']:'',
'ship_first_name' => isset($pp['address_name'])?$pp['address_name']:'',
'ship_address' => isset($pp['address_street'])?$pp['address_street']:'',
'ship_city' => isset($pp['address_city'])?$pp['address_city']:'',
'ship_state' => isset($pp['address_state'])?$pp['address_state']:'',
'ship_zip' => isset($pp['address_zip'])?$pp['address_zip']:'',
'ship_country' => isset($pp['address_country'])?$pp['address_country']:'',
'shipping_method' => $deliveryMethod,
'email' => $pp['payer_email'],
'phone' => isset($pp['contact_phone'])?$pp['contact_phone']:'',
'shipping' => $shipping_cost,
'tax' => isset($pp['tax'])?$pp['tax']:0,
'subtotal' => $subtotal,
'total' => $total,
'coupon' => $coupon_code,
'discount_amount' => $discount,
'trans_id' => isset($pp['txn_id'])?$pp['txn_id']:'',
'ordered_on' => date('Y-m-d H:i:s', WPSCommon::localTs()),
'status' => $status,
'ouid' => $ouid,
'payment_method' => 'Paypal',
'payment_status' => 'Complete',
'share_cart_discount_amount' => $share_cart_discount,
'price_inc_tax' => $tax_included_in_price,
);What do you think about?
December 3, 2017 at 9:41 pm #76837PeterMemberHi,
Which specific variables in that array are you referring to?
December 10, 2017 at 9:09 am #76838DesMasMemberHello
I noticed the following fields given as NULL:
– bill_state
– ship_state
– phone
Every time this happens to one of the fields i get the following error in the log:
[WPSPayPalStandard.php – line 180] Failed to insert the following into the order table: Array
I can send you the extracted log via mail due to the personal data in it I do now want to post it here in public.
December 11, 2017 at 2:02 am #76839PeterMemberOk yes I see what you mean now.
I will add those checks in the code. Thanks for your feedback.
-
AuthorPosts
- You must be logged in to reply to this topic.