title: Invalid argument supplied for foreach() using adldap
body: <p>I am using adldap <a href="http://adldap.sourceforge.net/" rel="nofollow noreferrer">http://adldap.sourceforge.net/</a></p>
  
  <p>And I am passing the session from page to page, and checking to make sure the username within the session is a member of a certain member group, for this example, it is the STAFF group.</p>
  
  <pre><code>&lt;?php
      ini_set('display_errors',1);
      error_reporting(E_ALL);
      require_once('/web/ee_web/include/adLDAP.php');
      $adldap = new adLDAP();
  
      session_start();
  
      $group = "STAFF";
  
      //$authUser = $adldap-&gt;authenticate($username, $password);
  
      $result=$adldap-&gt;user_groups($_SESSION['user_session']);
  
      foreach($result as $key=&gt;$value) {
          switch($value) {
              case $group:
                  print '&lt;h3&gt;'.$group.'&lt;/h3&gt;';
                  break;
  
              default:
                  print '&lt;h3&gt;Did not find specific value: '.$value.'&lt;/h3&gt;';
              }
          if($value == $group) { print 'for loop broke'; break; }
      }
  ?&gt;
  </code></pre>
  
  <p>It gives me the error: Warning: Invalid argument supplied for foreach() on line 15, which is this line of code: foreach($result as $key=>$value) {</p>
  
  <p>When I uncomment the code $authUser = $adldap->authenticate($username, $password); and enter in the appropriate username and password, it works fine, but I shouldn't have to, since the session is valid, I just want to see if the username stored within the valid_session is apart of the STAFF group.</p>
  
  <p>Why would it be giving me that problem?</p>