Skip to content

Commit fbf97ae

Browse files
committed
BUGFIX EXTCERT-862 Proper parsing of response in case if there is no subdomains.
1 parent 5725566 commit fbf97ae

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/PleskX/Api/Operator/Subdomain.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ public function getAll($field = null, $value = null)
7171

7272
$items = [];
7373
foreach ($response->xpath('//result') as $xmlResult) {
74+
if (empty($xmlResult->data)) {
75+
continue;
76+
}
7477
$item = new Struct\Info($xmlResult->data);
7578
$item->id = (int)$xmlResult->id;
7679
$items[] = $item;

tests/SubdomainTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,8 @@ public function testGetAll()
8282

8383
static::$_client->subdomain()->delete('id', $subdomain->id);
8484
static::$_client->subdomain()->delete('id', $subdomain2->id);
85+
86+
$subdomainsInfo = static::$_client->subdomain()->getAll();
87+
$this->assertEmpty($subdomainsInfo);
8588
}
8689
}

0 commit comments

Comments
 (0)