plesk/api-php-lib

PHP warning in subdomain()->getAll() if there are no subdomains

vlikhtanskiy opened this issue · 1 comments

STEPS TO REPRODUCE:
On server without any subdomains run:

$client = new PleskX\Api\Client(...);
var_dump($client->subdomain()->getAll());

And check logs.

ACTUAL RESULT:
PHP Warning: Invalid argument supplied for foreach(); File: /usr/local/psa/admin/plib/modules/wp-toolkit/vendor/plesk/api-php-lib/src/PleskX/Api/Struct/Subdomain/Info.php, Line: 28

And output:

array(1) {
  [0]=>
  object(PleskX\Api\Struct\Subdomain\Info)#297 (4) {
    ["id"]=>
    int(0)
    ["parent"]=>
    string(0) ""
    ["name"]=>
    string(0) ""
    ["properties"]=>
    array(0) {
    }
  }
}

EXPECTED RESULT:
No PHP warning and empty array.

Fixed in scope of fbf97ae commit.