500 Internal Server Error in WooCommerce gateway: Undefined variable: Transaction_ID

29 Views Asked by At

I got 500 Internal Server Error after payment is successful or failed. This request takes too long to process, it is timed out by the server. If it should not be timed out, please contact administrator of this web site to increase 'Connection Timeout'. debug log:

[24-Feb-2024 08:42:03 UTC] PHP Notice:  Undefined variable: Transaction_ID in /home/ppoigsdu/public_html/wp-content/plugins/zarinpal-woocommerce-payment-gateway/class-wc-gateway-zarinpal.php on line 471
[24-Feb-2024 08:42:03 UTC] PHP Notice:  Undefined variable: Transaction_ID in /home/ppoigsdu/public_html/wp-content/plugins/zarinpal-woocommerce-payment-gateway/class-wc-gateway-zarinpal.php on line 479
[24-Feb-2024 08:42:25 UTC] PHP Notice:  Undefined index: status in /home/ppoigsdu/public_html/wp-content/plugins/gateway-aqayepardakht-for-woocommerce/class-wc-gateway-aqayepardakht.php on line 269
[24-Feb-2024 08:42:25 UTC] PHP Notice:  Undefined index: transid in /home/ppoigsdu/public_html/wp-content/plugins/gateway-aqayepardakht-for-woocommerce/class-wc-gateway-aqayepardakht.php on line 270
[24-Feb-2024 08:42:25 UTC] PHP Notice:  Undefined index: tracking_number in /home/ppoigsdu/public_html/wp-content/plugins/gateway-aqayepardakht-for-woocommerce/class-wc-gateway-aqayepardakht.php on line 271
[24-Feb-2024 08:42:25 UTC] PHP Notice:  Undefined index: cardnumber in /home/ppoigsdu/public_html/wp-content/plugins/gateway-aqayepardakht-for-woocommerce/class-wc-gateway-aqayepardakht.php on line 272
[24-Feb-2024 08:42:25 UTC] PHP Notice:  تابع status به طورنادرست فراخوانی شد. Order properties should not be accessed directly. Backtrace: require('wp-blog-header.php'), wp, WP-&gt;main, WP-&gt;parse_request, do_action_ref_array('parse_request'), WP_Hook-&gt;do_action, WP_Hook-&gt;apply_filters, WC_API-&gt;handle_api_requests, do_action('woocommerce_api_wc_gateway_aqayepardakht'), WP_Hook-&gt;do_action, WP_Hook-&gt;apply_filters, WC_Gateway_aqayepardakht-&gt;Return_from_aqayepardakht_Gateway_Aqaye_Pardakht, WC_Abstract_Legacy_Order-&gt;__get, wc_doing_it_wrong لطفاً برای اطلاعات بیشتر، <a>اشکال زدایی در وردپرس</a> را مشاهده کنید. (این پیام در نگارش 3.0 افزوده شده است.) in /home/ppoigsdu/public_html/wp-includes/functions.php on line 6031
[24-Feb-2024 08:42:25 UTC] PHP Notice:  Undefined variable: Transaction_ID in /home/ppoigsdu/public_html/wp-content/plugins/gateway-aqayepardakht-for-woocommerce/class-wc-gateway-aqayepardakht.php on line 394
[24-Feb-2024 08:42:25 UTC] PHP Notice:  Undefined variable: Transaction_ID in /home/ppoigsdu/public_html/wp-content/plugins/gateway-aqayepardakht-for-woocommerce/class-wc-gateway-aqayepardakht.php on line 398
[24-Feb-2024 08:44:50 UTC] PHP Notice:  Undefined variable: Transaction_ID in /home/ppoigsdu/public_html/wp-content/plugins/zarinpal-woocommerce-payment-gateway/class-wc-gateway-zarinpal.php on line 486
[24-Feb-2024 08:44:50 UTC] PHP Notice:  Undefined variable: Transaction_ID in /home/ppoigsdu/public_html/wp-content/plugins/zarinpal-woocommerce-payment-gateway/class-wc-gateway-zarinpal.php on line 487
[24-Feb-2024 08:44:50 UTC] PHP Notice:  Undefined variable: Transaction_ID in /home/ppoigsdu/public_html/wp-content/plugins/zarinpal-woocommerce-payment-gateway/class-wc-gateway-zarinpal.php on line 492

It's clear that "Transaction_ID" is causing problem.

Above lines in cPanel:


                        if (($Transaction_ID && ($Transaction_ID != 0))) {
                            $tr_id = ('<br/>توکن : ' . $Transaction_ID);
                        } else {
                            $tr_id = '';
                        }

                        $Note = sprintf(__('خطا در هنگام بازگشت از بانک : %s %s', 'woocommerce'), $Message, $tr_id);

                        $Note = apply_filters('WC_ZPal_Return_from_Gateway_Failed_Note', $Note, $order_id, $Transaction_ID, $Fault);
                        if ($Note) {
                            $order->add_order_note($Note, 1);
                        }

                        $Notice = wpautop(wptexturize($this->failedMassage));

                        $Notice = str_replace(array('{transaction_id}', '{fault}'), array($Transaction_ID, $Message), $Notice);
                        $Notice = apply_filters('WC_ZPal_Return_from_Gateway_Failed_Notice', $Notice, $order_id, $Transaction_ID, $Fault);
                        if ($Notice) {
                            wc_add_notice($Notice, 'error');
                        }

                        do_action('WC_ZPal_Return_from_Gateway_Failed', $order_id, $Transaction_ID, $Fault);

I found the problem. after testing and replacing new codes and failing, I have disabled plugins one by one and found out that WP Mail SMTP has conflicting and causing the problem!

0

There are 0 best solutions below