title: PHP Warning: in_array() expects parameter 2 to be array, null given in /home/co
body: <p>I need code to avoid this error in this part:-
  added to woocommerce product edit page option to select specific user/s or specific user role/s or specific group/s the selected users will find in specific front end page a select box to choose product</p>
  
  <p>the only way to work without showing the error is ( I must select at least one user and one user role and one group) 
  if I left even if one field of the three fields empty then once the selected user visit the front end page  I got the next error in error_log</p>
  
  <blockquote>
    <p>[09-Apr-2020 15:55:52 UTC] PHP Warning: in_array() expects parameter 2
    to be array, null given in
    /home/comenzo/mysite.com/wp-content/plugins/myplugin/myplugin.php on
    line 1128</p>
  </blockquote>
  
  <p>also I get Notice in line 1128 </p>
  
  <blockquote>
    <p>Undefined offset: 0</p>
  </blockquote>
  
  <p>this is line 1128</p>
  
  <pre><code>if(in_array($user_id,get_post_meta($product_id,"product_user_list")[0]) || in_array($user_roles[0],get_post_meta($product_id,"product_user_role_list")[0]) || in_array($group_id,get_post_meta($product_id,"product_point_groups")[0])) {
  </code></pre>
  
  <p>the whole code of this part is</p>
  
  <pre><code>echo "&lt;label&gt;Select Product&lt;/label&gt;";
  echo '&lt;select class="user_product" name="user_product" class="form-control" style="margin-bottom:30px;margin-top:30px;" required&gt;';
  echo "&lt;option value='-1'&gt;Select Product&lt;/option&gt;";
  /*echo "&lt;h1&gt;HEllo JMM JMK JPD!&lt;/h1&gt;";*/
  foreach($product_ids as $product_id)
    { 
      $product = wc_get_product( $product_id );
      /*echo "&lt;h1&gt;HEllo JMM JMK JPD!&lt;/h1&gt;";
      print_r(get_post_meta($product_id,"product_user_list"));
      print_r(get_post_meta($product_id,"product_user_role_list"));
      print_r(get_post_meta($product_id,"product_point_groups"));*/
      if(in_array($user_id,get_post_meta($product_id,"product_user_list")[0]) || in_array($user_roles[0],get_post_meta($product_id,"product_user_role_list")[0]) || in_array($group_id,get_post_meta($product_id,"product_point_groups")[0])) {
          echo "&lt;h1&gt;IN&lt;/h1&gt;";
      ?&gt;
  </code></pre>
  
  <p>so please need code to avoid this error 
  need if I select only one field or tow from the three fields to not get this error or even if I don't select any of them </p>
  
  <p>regards</p>