Skip to content

Commit

Permalink
Remove accidental count call within an is_array check (#45939)
Browse files Browse the repository at this point in the history
Remove accidental count call within an is_array check that always renders false
  • Loading branch information
louwie17 authored and WooCommerce Bot committed Mar 28, 2024
1 parent 39796b5 commit 1c6f33f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
@@ -0,0 +1,4 @@
Significance: minor
Type: fix

Removed count from is_array check to fix Analytics comparison filter.
Expand Up @@ -165,7 +165,7 @@ protected function get_segments( $type, $query_params, $table_name ) {

$segments = $this->get_product_related_segments( $type, $segmenting_selections, $segmenting_from, $segmenting_where, $segmenting_groupby, $segmenting_dimension_name, $table_name, $query_params, $unique_orders_table );
} elseif ( 'variation' === $this->query_args['segmentby'] ) {
if ( ! isset( $this->query_args['product_includes'] ) || ! is_array( count( $this->query_args['product_includes'] ) ) || count( $this->query_args['product_includes'] ) !== 1 ) {
if ( ! isset( $this->query_args['product_includes'] ) || ! is_array( $this->query_args['product_includes'] ) || count( $this->query_args['product_includes'] ) !== 1 ) {
throw new ParameterException( 'wc_admin_reports_invalid_segmenting_variation', __( 'product_includes parameter need to specify exactly one product when segmenting by variation.', 'woocommerce' ) );
}

Expand Down

0 comments on commit 1c6f33f

Please sign in to comment.