Merge pull request #5228 from annando/fix-5199

Fix for PR 5199: Corrected check for empty object
This commit is contained in:
Tobias Diekershoff 2018-06-16 09:42:36 +02:00 committed by GitHub
commit 7966c48e75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1009,7 +1009,7 @@ class PortableContact
// Maybe the page is unencrypted only? // Maybe the page is unencrypted only?
$xmlobj = @simplexml_load_string($serverret["body"], 'SimpleXMLElement', 0, "http://docs.oasis-open.org/ns/xri/xrd-1.0"); $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); $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 // 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"); $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) // Workaround for bad configured servers (known nginx problem)
if (!in_array($serverret["debug"]["http_code"], ["403", "404"])) { if (!in_array($serverret["debug"]["http_code"], ["403", "404"])) {
$failure = true; $failure = true;