paytm / Paytm_Woocommerce_Plugin

https://developer.paytm.com/docs/eCommerce-plugin/woocommerce/
3 stars 5 forks source link

Error with Woo 6.6.0 #15

Open naveenrnimmala opened 2 years ago

naveenrnimmala commented 2 years ago

After updating with Woocommerce to 6.6.0, i had this error. Am able to use it after downgrading to 6.5.1

Not sure if it's Paytm plugin or Woo Please look into it.

An error of type E_ERROR was caused in line 51 of the file
/home/u186518178/domains/example.com/public_html/wp-content/plugins/woocommerce/src/Internal/Utilities/HtmlSanitizer.php.
Error message: Uncaught TypeError:
Automattic\WooCommerce\Internal\Utilities\HtmlSanitizer::sanitize():
Argument #1 ($html) must be of type string, null given, called in
/home/u186518178/domains/example.com/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-payment-gateway.php
on line 308 and defined in
/home/u186518178/domains/example.com/public_html/wp-content/plugins/woocommerce/src/Internal/Utilities/HtmlSanitizer.php:51
Stack trace:
#0 /home/u186518178/domains/example.com/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-payment-gateway.php(308):
Automattic\WooCommerce\Internal\Utilities\HtmlSanitizer->sanitize()
#1 /home/u186518178/domains/example.com/public_html/wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-payment-gateways.php(163):
WC_Payment_Gateway->get_title()
#2 /home/u186518178/domains/example.com/public_html/wp-includes/class-wp-hook.php(307):
WC_Settings_Payment_Gateways->payment_gateways_setting()
#3 /home/u186518178/domains/example.com/public_html/wp-includes/class-wp-hook.php(331):
WP_Hook->apply_filters()
#4 /home/u186518178/domains/example.com/public_html/wp-includes/plugin.php(476):
WP_Hook->do_action()
#5 /home/u186518178/domains/example.com/public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php(729):
do_action()
#6 /home/u186518178/domains/example.com/public_html/wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-page.php(213):
WC_Admin_Settings::output_fields()
#7 /home/u186518178/domains/example.com/public_html/wp-content/plugins/woocommerce/includes/admin/settings/class-wc-settings-payment-gateways.php(94):
WC_Settings_Page->output()
#8 /home/u186518178/domains/example.com/public_html/wp-includes/class-wp-hook.php(307):
WC_Settings_Payment_Gateways->output()
#9 /home/u186518178/domains/example.com/public_html/wp-includes/class-wp-hook.php(331):
WP_Hook->apply_filters()
#10 /home/u186518178/domains/example.com/public_html/wp-includes/plugin.php(476):
WP_Hook->do_action()
#11 /home/u186518178/domains/example.com/public_html/wp-content/plugins/woocommerce/includes/admin/views/html-admin-settings.php(40):
do_action()
#12 /home/u186518178/domains/example.com/public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php(154):
include('/home/u18651817...')
#13 /home/u186518178/domains/example.com/public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-menus.php(280):
WC_Admin_Settings::output()
#14 /home/u186518178/domains/example.com/public_html/wp-includes/class-wp-hook.php(307):
WC_Admin_Menus->settings_page()
#15 /home/u186518178/domains/example.com/public_html/wp-includes/class-wp-hook.php(331):
WP_Hook->apply_filters()
#16 /home/u186518178/domains/example.com/public_html/wp-includes/plugin.php(476):
WP_Hook->do_action()
#17 /home/u186518178/domains/example.com/public_html/wp-admin/admin.php(259):
do_action()
#18 {main}
  thrown
sam0hack commented 2 years ago

It's not the wooCommerce they don't make silly mistakes like Paytm's dumb developers. I don't think they test it before publishing the release. There is only one release on GitHub that was in 2020 with no change-log or any explanation and the same with the WordPress releases. You will find absolutely nothing useful in case of any major error like this one. A lot of people are losing customers and sales because of this kind of silly error in the paytm.

To quick fix, the problem Go to class.paytm.php and inside the __construct method uncomment the //$this->title and change to $this-> title = 'some string or leave it empty ' <--- should be line number 27. This will fix the fetal problem that you have.

To quick fix other minor errors

inside the class.paytm.php there is method init_form_fields() and inside this method there is$getPaytmSetting = get_option('woocommerce_paytm_settings'); Which gives bool false if there is no woocommerce_paytm_settings which cause an error on line number 77 $getPaytmSetting['website'] So just add check there $website = !empty($getPaytmSetting) ? $getPaytmSetting['website'] : '';

Another one is in the woo-paytm.php on line number 167 $settings = get_option("woocommerce_paytm_settings"); Quick fix if (!empty($settings)) { // paytm enabled and order is exists with paym_order_data if ($settings['enabled'] == 'yes' && !empty($results)) { add_meta_box( '_paytm_response_table', __('Paytm Payments'), '_paytm_response_table', 'shop_order', 'normal', 'default', array('results' => $results) ); } }

Hope that fixes the problems and your site will be up and running.

And paytm developers you should test everything thoroughly before releasing it.