From d2da5d63c78f03dca145d9d1c4d30712ce817bc6 Mon Sep 17 00:00:00 2001
From: Michael <heluecht@pirati.ca>
Date: Sat, 16 Jun 2018 07:26:09 +0000
Subject: [PATCH] Fix for PR 5199: Corrected check for empty object

---
 src/Protocol/PortableContact.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Protocol/PortableContact.php b/src/Protocol/PortableContact.php
index 2dcc047406..719148a8e6 100644
--- a/src/Protocol/PortableContact.php
+++ b/src/Protocol/PortableContact.php
@@ -1009,7 +1009,7 @@ class PortableContact
 
 		// Maybe the page is unencrypted only?
 		$xmlobj = @simplexml_load_string($serverret["body"], 'SimpleXMLElement', 0, "http://docs.oasis-open.org/ns/xri/xrd-1.0");
-		if (!$serverret["success"] || ($serverret["body"] == "") || (empty($xmlobj) == 0) || !is_object($xmlobj)) {
+		if (!$serverret["success"] || ($serverret["body"] == "") || empty($xmlobj) || !is_object($xmlobj)) {
 			$server_url = str_replace("https://", "http://", $server_url);
 
 			// We set the timeout to 20 seconds since this operation should be done in no time if the server was vital
@@ -1025,7 +1025,7 @@ class PortableContact
 			$xmlobj = @simplexml_load_string($serverret["body"], 'SimpleXMLElement', 0, "http://docs.oasis-open.org/ns/xri/xrd-1.0");
 		}
 
-		if (!$serverret["success"] || ($serverret["body"] == "") || (empty($xmlobj) == 0) || !is_object($xmlobj)) {
+		if (!$serverret["success"] || ($serverret["body"] == "") || empty($xmlobj) || !is_object($xmlobj)) {
 			// Workaround for bad configured servers (known nginx problem)
 			if (!in_array($serverret["debug"]["http_code"], ["403", "404"])) {
 				$failure = true;