You are here

protected function LdapTransformationTraits::ldapEscapeFilter in Lightweight Directory Access Protocol (LDAP) 8.4

Wrapper for ldap_escape().

Helpful for unit testing without the PHP LDAP module.

Parameters

string $value: String to escape.

Return value

string Escaped string.

1 call to LdapTransformationTraits::ldapEscapeFilter()
LdapBaseManager::queryLdapForUsername in ldap_servers/src/LdapBaseManager.php
Queries LDAP server for the user.

File

ldap_servers/src/LdapTransformationTraits.php, line 55

Class

LdapTransformationTraits
Helper functions to work around hard dependencies on the LDAP extension.

Namespace

Drupal\ldap_servers

Code

protected function ldapEscapeFilter($value) : string {
  if (\function_exists('ldap_escape')) {
    $value = ldap_escape($value, '', LDAP_ESCAPE_FILTER);
  }
  else {
    $value = self::php56PolyfillLdapEscape($value, '', 1);
  }
  return $value;
}