Closed iraudasoja closed 4 months ago
class-wc-gateway-abstract-maksuturva.php:972
Ongelma tulee siitä kun wp_remote_post() palauttaa arrayn ja tämä array syötetään preg_match()-funktioon.
Korjausehdotus
$res = wp_remote_post( $this->base_url_status_query, array( 'body' => $this->status_query_data, 'timeout' => 30, 'user-agent' => WC_Utils_Maksuturva::get_user_agent(), ) ); if ( wp_remote_retrieve_response_code( $res ) !== \WP_Http::OK ) { throw new WC_Gateway_Maksuturva_Exception( 'Failed to communicate with Svea Payments API. Please check the network connection.' ); } $resp_body = wp_remote_retrieve_body( $res ); // Pihvi tässä // We will not rely on xml parsing - instead, // the fields are going to be collected by means of regular expression. $parsed_response = array(); $response_fields = array( 'pmtq_action', 'pmtq_version', 'pmtq_sellerid', 'pmtq_id', 'pmtq_amount', 'pmtq_returncode', 'pmtq_returntext', 'pmtq_trackingcodes', 'pmtq_sellercosts', 'pmtq_invoicingfee', 'pmtq_orderid', 'pmtq_paymentmethod', 'pmtq_escrow', 'pmtq_certification', 'pmtq_paymentdate', 'pmtq_buyername', 'pmtq_buyeraddress1', 'pmtq_buyeraddress2', 'pmtq_buyerpostalcode', 'pmtq_buyercity', 'pmtq_hash', ); foreach ( $response_fields as $field ) { preg_match( "/<$field>(.*)?<\/$field>/i", $resp_body, $matches ); if ( 2 === count( $matches ) ) { $parsed_response[ $field ] = $matches[1]; } }
Koko stacktrace alla.
PHP Fatal error: Uncaught TypeError: preg_match(): Argument #2 ($subject) must be of type string, array given in /data/wordpress/htdoc s/wp-content/plugins/woocommerce-payment-module/includes/class-wc-gateway-abstract-maksuturva.php:972 Stack trace: #0 /data/wordpress/htdocs/wp-content/plugins/woocommerce-payment-module/includes/class-wc-gateway-abstract-maksuturva.php(972): preg_match('/<pmtq_action>(...', Array, NULL) #1 /data/wordpress/htdocs/wp-content/plugins/woocommerce-payment-module/includes/class-wc-payment-checker-maksuturva.php(156): WC_Gateway_Abstract_Maksuturva->status_query() #2 /data/wordpress/htdocs/wp-content/plugins/woocommerce-payment-module/includes/class-wc-payment-checker-maksuturva.php(236): WC_Payment_Checker_Maksuturva->check_payment(Object(WC_Payment_Maksuturva)) #3 /data/wordpress/htdocs/wp-content/plugins/woocommerce-payment-module/wc-maksuturva.php(391): WC_Payment_Checker_Maksuturva->check_payments(Array) #4 /data/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(324): WC_Maksuturva->check_pending_payments() #5 /data/wordpress/htdocs/wordpress/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #6 /data/wordpress/htdocs/wordpress/wp-includes/plugin.php(565): WP_Hook->do_action(Array) #7 /data/wordpress/htdocs/wordpress/wp-cron.php(191): do_action_ref_array('maksuturva_chec...', Array) #8 {main} thrown in /data/wordpress/htdocs/wp-content/plugins/woocommerce-payment-module/includes/class-wc-gateway-abstract-maksuturva.php on line 972
Kiitos tämän raportoinnista. Nyt tuohon on korjaus ja testattu toimivaksi versiossa 2.6.4.
https://github.com/maksuturva/woocommerce_payment_module/releases/tag/2.6.4
class-wc-gateway-abstract-maksuturva.php:972
Ongelma tulee siitä kun wp_remote_post() palauttaa arrayn ja tämä array syötetään preg_match()-funktioon.
Korjausehdotus
Koko stacktrace alla.