Skip to content

Commit

Permalink
fixed some more issues revealed by scrutinizer.
Browse files Browse the repository at this point in the history
  • Loading branch information
jens-maus committed May 12, 2016
1 parent 4d21df5 commit 50705dc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions carddav2fb.php
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,13 @@ public function build_fb_xml()
$contact->addChild("mod_time", (string)time());
}

$this->fbxml = $root->asXML();
if($root->asXML() != false)
$this->fbxml = $root->asXML();
else
{
print " ERROR: created XML data isn't well-formed." . PHP_EOL;
exit(1);
}
}

public function _convert_text($text)
Expand All @@ -651,8 +657,7 @@ public function _concat($text1, $text2)

public function _parse_fb_result($text)
{
preg_match("/\<h2\>([^\<]+)\<\/h2\>/", $text, $matches);
if($matches)
if(preg_match("/\<h2\>([^\<]+)\<\/h2\>/", $text, $matches) == 1 && !empty($matches))
return $matches[1];
else
return "Error while uploading xml to fritzbox";
Expand Down

0 comments on commit 50705dc

Please sign in to comment.