/**
  * Magic __set() function, handles changing server settings.
  *
  * @param string $name
  *   The name of the attribute to set.
  * @param mixed $value
  *   The value to assigned to the given attribute.
  */
 public function __set($name, $value)
 {
     switch ($name) {
         case 'host':
         case 'port':
         case 'starttls':
             $this->disconnect();
         case 'binddn':
         case 'bindpw':
             $this->unbind();
         case 'pagesize':
             $this->{$name} = $value;
             break;
             // Handle PHP LDAP options.
         // Handle PHP LDAP options.
         case 'LDAP_OPT_DEREF':
         case 'LDAP_OPT_SIZELIMIT':
         case 'LDAP_OPT_TIMELIMIT':
         case 'LDAP_OPT_NETWORK_TIMEOUT':
         case 'LDAP_OPT_ERROR_NUMBER':
         case 'LDAP_OPT_REFERRALS':
         case 'LDAP_OPT_RESTART':
         case 'LDAP_OPT_HOST_NAME':
         case 'LDAP_OPT_ERROR_STRING':
         case 'LDAP_OPT_MATCHED_DN':
         case 'LDAP_OPT_SERVER_CONTROLS':
         case 'LDAP_OPT_CLIENT_CONTROLS':
             $this->connect();
             SimpleLdap::ldap_get_option($this->resource, constant($name), $old_value);
             $result = SimpleLdap::ldap_set_option($this->resource, constant($name), $value);
             if ($result && $old_value != $value) {
                 $this->unbind();
             }
             break;
             // LDAPv3 is required, do not allow it to be changed.
         // LDAPv3 is required, do not allow it to be changed.
         case 'LDAP_OPT_PROTOCOL_VERSION':
             return FALSE;
         default:
     }
 }