Scalr\Net\Ldap\LdapClient::realEscape PHP Method

realEscape() public static method

Escapes query string including asterisk and parentheses
public static realEscape ( string $string ) : string
$string string The query string
return string
    public static function realEscape($string)
    {
        return preg_replace(array('/[\\r\\n]+/', '/(^ |[\\\\]|[,#+<>;"=*\\(\\)\\/]| $)/'), array('', '\\\\$1'), $string);
    }

Usage Example

示例#1
0
 /**
  * @test
  * @dataProvider providerRealEscape
  * @param   string     $input    Input string
  * @param   string     $expected Expected string
  */
 public function testRealEscape($input, $expected)
 {
     $this->assertEquals($expected, LdapClient::realEscape($input));
 }