|
@@ -69,11 +69,23 @@ class Zend_Ldap_Converter
|
|
|
*/
|
|
*/
|
|
|
public static function hex32ToAsc($string)
|
|
public static function hex32ToAsc($string)
|
|
|
{
|
|
{
|
|
|
- $string = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''", $string);
|
|
|
|
|
|
|
+ // Using a callback, since PHP 5.5 has deprecated the /e modifier in preg_replace.
|
|
|
|
|
+ $string = preg_replace_callback("/\\\([0-9A-Fa-f]{2})/", array('Zend_Ldap_Converter', '_charHex32ToAsc'), $string);
|
|
|
return $string;
|
|
return $string;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * Convert a single slash-prefixed character from Hex32 to ASCII.
|
|
|
|
|
+ * Used as a callback in @see hex32ToAsc()
|
|
|
|
|
+ * @param array $matches
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return string
|
|
|
|
|
+ */
|
|
|
|
|
+ private static function _charHex32ToAsc(array $matches) {
|
|
|
|
|
+ return chr(hexdec($matches[0]));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* Convert any value to an LDAP-compatible value.
|
|
* Convert any value to an LDAP-compatible value.
|
|
|
*
|
|
*
|
|
|
* By setting the <var>$type</var>-parameter the conversion of a certain
|
|
* By setting the <var>$type</var>-parameter the conversion of a certain
|
|
@@ -394,4 +406,4 @@ class Zend_Ldap_Converter
|
|
|
}
|
|
}
|
|
|
return $v;
|
|
return $v;
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+}
|