• Resolved humbug11

    (@humbug11)


    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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author wpgateways

    (@wpgateways)

    @humbug11,

    I am little bit confused here, Can you please provide PHP error log file for more troubleshoot?

    renatofrota

    (@renatofrota)

    +1, a customer of mine faced the same issue.

    Shortly: the _transaction_id meta does not have the PayPal transaction ID but a WC_Order object. Why it has been saved this way in the database? I have no idea.

    “Workaround” to load Orders list (and the order that renders a 500 ISE error): replace the WC_Order object with a ‘X’ or clear up the value (set the meta value field blank).

    “Definitive” solution to prevent the problem returning was to switch to the plugin offered by WooCommerce.com:

    https://woocommerce.com/products/woocommerce-gateway-paypal-express-checkout/

    Thread Starter humbug11

    (@humbug11)

    @wpgateways there is no PHP log. PHP goes into an endless loop and crashes (segfault). It took me quite a while to track this down trying PHP5 and PHP7 etc.

    I’m also getting same issue, but not for all orders, but yes if customer placed 20 orders from paypal then approx 6-8 ordres doesn’t have paypal tansaction id on _transaction_id meta key. That’s why my website goes break.

    Please let me know how you guys fixed it, is there any way to fix it instead of moving with another plugin?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP crash due to WC_Order stored in _transaction_id’ is closed to new replies.