in_array not working on dev server but works on localhost

I’ve written a loop which works on my local machine but not on my dev server. My dev server is running PHP 7.4.13 and my MAMPRO is running 7.4.12.

The dev server code displays nothing and with no errors and the local version displays as expected.

7.4.12 is not installed my server so I cannot test to see if it is a version issue.

I tried printing the variables at different stages, but nothing happened inside the if(in_array part.

Is the PHP version difference likely to be the cause or is it likely to be something else?

                // Query products where product title matches a tag in the current article                  $  current_article_tags = wp_get_object_terms(get_the_ID(), 'knowledge_hub_tag', array('fields' => 'names'));                  //echo '<pre>'; print_r($  current_article_tags); echo '</pre>';                  $  related_products = new WP_Query(array(                   'posts_per_page' => -1,                   'post_type'=> 'product',                   /*'post_title' => array(                       array(                           //'taxonomy' => $  current_article_tags,                           'post_title' => 'varilite icon mid',                           'operator'=> 'IN' //Or 'AND' or 'NOT IN'                       ),                   )*/                 ));                  //echo '<pre>'; print_r($  related_products); echo '</pre>';                  $  products = $  related_products->posts;                  //echo '<pre>'; print_r($  products); echo '</pre>';                  //if ($  related_products->have_posts()){                      foreach($  products as $  product) {                          if(in_array($  product->post_title, $  current_article_tags, true)) {                                                             echo '<p><a href="'.get_permalink( $  product ).'">'.get_the_title($  product).'</a></p>';                         }                     }                  //}                  //wp_reset_postdata();