X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FUtil%2FXML.php;h=e8eb4233b1a8a3040da04da6b68cb02c7aaadc50;hb=71cf72cc8bde161471b2294c675fb0500dd48399;hp=ec4bbe15f1e2c6a1f470aeebc6e84abe1c5ee75e;hpb=20b25a1acd3db84a043447729f2bdccedc19c515;p=friendica.git diff --git a/src/Util/XML.php b/src/Util/XML.php index ec4bbe15f1..e8eb4233b1 100644 --- a/src/Util/XML.php +++ b/src/Util/XML.php @@ -1,6 +1,6 @@ code . " at " . $err->line . ":" . $err->column . " : " . $err->message, Logger::DATA); + Logger::debug('libxml: parse: ' . $err->code . " at " . $err->line . ":" . $err->column . " : " . $err->message); } libxml_clear_errors(); return; @@ -488,13 +488,19 @@ class XML return $first_item->attributes; } - public static function queryValue($xpath, $search, $context) + public static function getFirstValue($xpath, $search, $context) { - $result = $xpath->query($search, $context)->item(0)->nodeValue; + $result = $xpath->query($search, $context); if (!is_object($result)) { return ''; } - return $result->nodeValue; + + $first_item = $result->item(0); + if (!is_object($first_item)) { + return ''; + } + + return $first_item->nodeValue; } /**