Skip to content

Commit

Permalink
Clean up quote backslashes before some special chars (#91)
Browse files Browse the repository at this point in the history
  • Loading branch information
derwok authored and andig committed Jan 12, 2019
1 parent ab291da commit 3c3730d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/FritzBox/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ public function convert($card)
$this->addVip();
// add Person
$person = $this->contact->addChild('person');
$name = htmlspecialchars($this->getProperty('realName'));
$person->addChild('realName', $name);
$realName = htmlspecialchars($this->getProperty('realName'));
$person->addChild('realName', $realName);
// add photo
if (isset($this->card->rawPhoto) && isset($this->card->imageURL)) {
if (isset($this->configImagePath)) {
Expand Down
9 changes: 9 additions & 0 deletions src/Vcard/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,15 @@ protected function parse()
$i++;
}

// Unquote COMMA, SEMICOLON and BACKSPACE as per RFC 6350 chap. 3.4
// https://tools.ietf.org/html/rfc6350#section-3.4
// But we don't do this on potential binary data!
if (!$rawValue) {
$value = str_replace("\\,", ",", $value); // \, => ,
$value = str_replace("\\;", ";", $value); // \; => ;
$value = str_replace("\\\\", "\\", $value); // \\ => \
}

switch (strtoupper($element)) {
case 'FN':
$cardData->fullname = $value;
Expand Down

0 comments on commit 3c3730d

Please sign in to comment.