Commit 60748033 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #4610 Fixed postalAddress special handling

Showing with 14 additions and 25 deletions
+14 -25
......@@ -237,35 +237,24 @@ class PostalAddressAttribute extends TextAreaAttribute
{
function inputValue ($ldapValue)
{
$string = $ldapValue;
$offset = 0;
$lastslash = NULL;
while (preg_match('/[\\\$]/', $string, $m, PREG_OFFSET_CAPTURE, $offset)) {
$offset = $m[0][1] + 1;
if ($m[0][0] == '\\') {
if ($lastslash == $m[0][1] - 1) {
$string = substr_replace($string, '\\', $m[0][1] - 1, 2);
$offset = $m[0][1];
$lastslash = NULL;
} else {
$lastslash = $m[0][1];
}
} elseif ($m[0][0] == '$') {
if ($lastslash == $m[0][1] - 1) {
$string = substr_replace($string, '$', $m[0][1] - 1, 2);
$offset = $m[0][1];
} else {
$string = substr_replace($string, "\n", $m[0][1], 1);
$offset = $m[0][1];
}
}
}
return $string;
return str_replace(
array('$', '\24','\5C'),
array("\n", '$', '\\'),
$ldapValue
);
}
function computeLdapValue ()
{
return str_replace(array("\r\n", "\n", "\r"), '$', addcslashes($this->getValue(), '$\\'));
return str_replace(
array("\r\n", "\n", "\r"),
'$',
str_replace(
array('\\', '$'),
array('\5C','\24'),
$this->getValue()
)
);
}
}
......
  • bmortier @bmortier

    mentioned in issue #1470 (closed)

    By mhamant on 2017-09-02T15:27:19 (imported from GitLab)

    ·

    mentioned in issue #1470 (closed)

    By mhamant on 2017-09-02T15:27:19 (imported from GitLab)

    Toggle commit list
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment