Skip to content

BUGFIX EXTPLESK-8950 Fix case when getAll returns 1 database instead of 0#188

Open
whytea91 wants to merge 1 commit intoplesk:masterfrom
whytea91:bugfix-correctly-fetch-current-databases-number
Open

BUGFIX EXTPLESK-8950 Fix case when getAll returns 1 database instead of 0#188
whytea91 wants to merge 1 commit intoplesk:masterfrom
whytea91:bugfix-correctly-fetch-current-databases-number

Conversation

@whytea91
Copy link

@whytea91 whytea91 commented Feb 3, 2026

When there are no databases on a domain, the API returns:

<?xml version="1.0" encoding="UTF-8"?>
<packet version="1.6.9.1">
    <database>
        <get-db>
            <result>
                <status>ok</status>
                <filter-id>nodatabase.com</filter-id>
            </result>
        </get-db>
    </database>
</packet>

However, the getAll method returns one object with empty values (because if ($xmlResult) is always true, even when there are no DBs).

@sibprogrammer sibprogrammer self-requested a review February 3, 2026 18:12
@whytea91 whytea91 force-pushed the bugfix-correctly-fetch-current-databases-number branch from 619c2b3 to 73c3eeb Compare February 4, 2026 14:24
$items = [];
foreach ((array) $response->xpath('//result') as $xmlResult) {
if ($xmlResult) {
if (isset($xmlResult->id) && (int) $xmlResult->id > 0) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$xmlResult check was removed w/o a reason. Please also make sure composer lint doesn't emit any errors.

@whytea91 whytea91 force-pushed the bugfix-correctly-fetch-current-databases-number branch from 73c3eeb to c298f6f Compare February 5, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants