Repository navigation
fix(plesk): list a panel that has no customers or no resellers - #448
Conversation
Plesk answers an empty list with one result that is ok and carries nothing: no id, no data. The owners list read it as an owner and the whole account list stopped with 'Attempt to read property "login" on null'. Every list now takes only the results that carry data, which also lets the last subscription's customer be removed when Plesk answers that way for what is left.
|
Merged — thank you. "ok and carries nothing" is a shape worth knowing about, and taking only the results that carry data is the right answer everywhere rather than at the one call that crashed. Measured:
The second effect deserves saying out loud, since it changes what happens to a customer's account rather than what a list shows: with the bug, an empty answer counted as one remaining subscription, so terminating the last service never removed the Plesk customer — it always reported that others remained. With this fix that deletion path works for the first time since #426 added it. It is the intended behaviour and it is guarded by a real count, but an operator who had grown used to the customer being left behind will see something new. Merging is not shipping: this reaches installations with the next release. |
|
Released in 1.29.0 — thank you. Gates on the tag: the full suite 5426 passed, 0 failed; the update lab's 14 scenarios green on a run of its own; the real package updating 1.28.0 on the stable channel and the last beta on the beta channel. |
Summary
On a Plesk server that has no customers, or no resellers, the account list for linking and for the sync page failed with
Attempt to read property "login" on null.Plesk answers an empty list with one result that is ok and carries nothing:
owners()selected everyresult[status="ok"]and read that one as an owner. It has nodata, sogen_infowas null and the whole list stopped. The server where I met it holds only subscriptions of the administrator and of customers, with no reseller.Every list read from the XML API now takes only the results that carry data (
result[status="ok"][data]): owners, subscriptions, the sync page's details and the reseller accounts.The same shape had a second effect, fixed by the same change. When the last subscription of a customer is terminated, the module counts what the customer has left; an empty answer counted as one subscription, so the Plesk customer was kept with the message that other subscriptions remained.
Linked issue
None. Follow-up to #426 and #428, where these reads were added.
Type of change
Checklist
main./vendor/bin/pint --testpasses (changed files)./vendor/bin/phpstan analysepasses: not run for this change; only xpath strings and a comment changed in the modulephp artisan testpasses: I ran the Plesk and server sync test files only (99 tests, on MariaDB), not the full suitePleskExistingSubscriptionsTest, both fail onmaindocs/,README.md,.env.example) where relevant: not applicablelang/en/: not applicableAdditional context
The empty-result shape for owners is what the error on the real server points to: the same message at the same line comes from a test that feeds it. I have not captured that server's raw answer, and I have not confirmed on a real server that the filtered
webspaceget (byowner-id) answers with the same empty result when nothing is left; the change is safe either way, because a real subscription always carriesdatawhengen_infois asked for.