From 36c7a55d949d94a45102e87dc51d35ef4cfdd4eb Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Fri, 9 Mar 2018 11:07:06 +0100 Subject: [PATCH 1/2] WooCommerce Analytics: fix PHP warning. "PHP Warning: str_replace() expects at least 3 parameters, 2 given" Adding the last parameter should help. --- .../classes/wp-woocommerce-analytics-universal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/woocommerce-analytics/classes/wp-woocommerce-analytics-universal.php b/modules/woocommerce-analytics/classes/wp-woocommerce-analytics-universal.php index 9745b91c0c686..fb1238e71459a 100644 --- a/modules/woocommerce-analytics/classes/wp-woocommerce-analytics-universal.php +++ b/modules/woocommerce-analytics/classes/wp-woocommerce-analytics-universal.php @@ -179,7 +179,7 @@ public function remove_from_cart_attributes( $url, $key ) { esc_attr( $product->get_id() ), esc_attr( $product->get_sku() ) ); - $url = str_replace( 'href=', $new_attributes ); + $url = str_replace( 'href=', $new_attributes, $url ); return $url; } From cce1350281ad1304d993c6e92cf2064fb09812fd Mon Sep 17 00:00:00 2001 From: Jeremy Herve Date: Fri, 9 Mar 2018 14:42:59 +0100 Subject: [PATCH 2/2] Google Analytics: avoid PHP warnings. @see https://github.com/Automattic/jetpack/pull/9021#pullrequestreview-102604909 --- .../classes/wp-google-analytics-universal.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/google-analytics/classes/wp-google-analytics-universal.php b/modules/google-analytics/classes/wp-google-analytics-universal.php index 8c1b416764ec7..eb6734b35f843 100644 --- a/modules/google-analytics/classes/wp-google-analytics-universal.php +++ b/modules/google-analytics/classes/wp-google-analytics-universal.php @@ -5,7 +5,7 @@ * https://developers.google.com/analytics/devguides/collection/analyticsjs/ * https://developers.google.com/analytics/devguides/collection/analyticsjs/enhanced-ecommerce * -* @author allendav +* @author allendav */ /** @@ -263,7 +263,7 @@ public function remove_from_cart_attributes( $url, $key ) { esc_attr( $product->get_id() ), esc_attr( $product->get_sku() ) ); - $url = str_replace( 'href=', $new_attributes ); + $url = str_replace( 'href=', $new_attributes, $url ); return $url; } @@ -409,4 +409,4 @@ public function send_pageview_in_footer() { wc_enqueue_js( "ga( 'send', 'pageview' );" ); } -} \ No newline at end of file +}