PHP crash due to WC_Order stored in _transaction_id
-
I have been running a woocommerce store for a few years and recently came across an odd bug. I have an order that when attempting to look at it through the admin interface or otherwise causes PHP to crash crash (segfault).
After some digging, I found that the problem is due to an infinite loop; the WC_Order constructor calls WC_Order_Data_Store_CPT->read_order_data, which contains the line
‘transaction_id’ => get_post_meta( $id, ‘_transaction_id’, true ),
however, for the problematic order, the value of _transaction_id in the wp_postmeta table is “”O:8:”WC_Order”:1:{s:5:”?*?id”;i:5137;}”, which seems to be a serialized WC_Order object. Loading it causes an infinite loop in the constructor.I’m not sure how or why the value of _transaction_id is the serialized object for this order. The order was originally paid using the “PayPal Express Checkout for WooCommerce” plugin, but the customer recently opened a claim via PayPal, after which the problem appeared. I had the same problem with a different order after I manually issued a refund via PayPal.
I opened a bug report with woocommerece (https://github.com/woocommerce/woocommerce/issues/17844) and they confirmed that the issue is with the payment gateway, which sets the transaction_id
- The topic ‘PHP crash due to WC_Order stored in _transaction_id’ is closed to new replies.