-
Notifications
You must be signed in to change notification settings - Fork 35
Open
Description
You have to check the status of each subscription before calling the children() method on each iteration. Subscription with status error gives a fatal error of the PHP script since it does not have any children...
`protected function processResponse($xml)
{
$result = [];
for ($i = 0; $i < count($xml->webspace->get->result); $i++) {
$webspace = $xml->webspace->get->result[$i];
if ( $webspace->status != "ok" )
continue;
foreach ($webspace->data->hosting->children() as $host) {
$hosting[$host->getName()] = Xml::getProperties($host);
}
$subscriptions = [];
foreach ($webspace->data->subscriptions->children() as $subscription) {
$subscriptions[] = [
'locked' => (bool)$subscription->locked,
'synchronized' => (bool)$subscription->synchronized,
'plan-guid' => (string)$subscription->plan->{"plan-guid"},
];
}
$result[] = [
'id' => (string)$webspace->id,
'status' => (string)$webspace->status,
'subscription_status' => (int)$webspace->data->gen_info->status,
'created' => (string)$webspace->data->gen_info->cr_date,
'name' => (string)$webspace->data->gen_info->name,
'owner_id' => (string)$webspace->data->gen_info->{"owner-id"},
'hosting' => $hosting,
'real_size' => (int)$webspace->data->gen_info->real_size,
'dns_ip_address' => (string)$webspace->data->gen_info->dns_ip_address,
'htype' => (string)$webspace->data->gen_info->htype,
'subscriptions' => $subscriptions,
];
}
return $result;
}`
So I just put a simple check:
if ( $webspace->status != "ok" ) continue;
And it is OK.
Thanks for committing this.
jpduits
Metadata
Metadata
Assignees
Labels
No labels