Z-push Carddav with DaviCal backend: newlines in values

I have an issue with multi lines fields with a carddav (Davical) backend. When creating or updating a contact with multiple lines in the note field, the value gets cut off because an invalid vcard is created. To fix this I have added this line in carddav.php, line 1269:

$val = str_replace("\n", "\\n", $val);

This escapes the newlines in the value, which make sure that a valid vcard is created in Davical.