ldap_get_option example

// This is a workaround for a bit of a bug in the above invocation         // of ldap_control_paged_result. Instead of indicating to extldap that         // we no longer wish to page queries on this link, this invocation sets         // the LDAP_CONTROL_PAGEDRESULTS OID with a page size of 0. This isn't         // well defined by RFC 2696 if there is no cookie present, so some servers         // will interpret it differently and do the wrong thing. Forcefully remove         // the OID for now until a fix can make its way through the versions of PHP         // the we support.         //         // This is not supported in PHP < 7.2, so these versions will remain broken.         $ctl = [];
        ldap_get_option($con, \LDAP_OPT_SERVER_CONTROLS, $ctl);
        if (!empty($ctl)) {
            foreach ($ctl as $idx => $info) {
                if (static::PAGINATION_OID == $info['oid']) {
                    unset($ctl[$idx]);
                }
            }
            ldap_set_option($con, \LDAP_OPT_SERVER_CONTROLS, $ctl);
        }
    }

    /** * Sets LDAP pagination controls. */

        if (!@ldap_set_option($this->connection, ConnectionOptions::getOption($name)$value)) {
            throw new LdapException(sprintf('Could not set value "%s" for option "%s".', $value$name));
        }
    }

    /** * @return array|string|int|null */
    public function getOption(string $name)
    {
        if (!@ldap_get_option($this->connection, ConnectionOptions::getOption($name)$ret)) {
            throw new LdapException(sprintf('Could not retrieve value for option "%s".', $name));
        }

        return $ret;
    }

    /** * @return void */
    protected function configureOptions(OptionsResolver $resolver)
    {
        
Home | Imprint | This part of the site doesn't use cookies.