Script hook returned an invalid response - cpanel termination
lucasRolff opened this issue · comments
Version information
Latest version
Steps to replicate
- Create a cPanel user
- Add domain to SpamExperts cluster
- Try terminate the cPanel users, this will halt the user-deletion half way through.
Actual result
==> error_log <==
[2017-08-12 21:58:21 +0200] info [xml-api] Script hook returned an invalid response:
[2017-08-12 21:58:21 +0200] info [xml-api] script: /usr/local/prospamfilter/bin/hook.php
[2017-08-12 21:58:21 +0200] info [xml-api] response: Deleting domain: $domain.com..Done
Expected result
Being able to terminate accounts.
Other notes
Hello,
Thank you for letting us know.
Please provide us the exact version of the cPanel so we can try to replicate this on our end. We tried to do this so far, but were not able to replicate the issue.
From the log we see you have "Deleting domain: $domain.com". Did you test using "domain.com" or "$domain.com". The second value seems to be weird since cPanel will not consider it valid.
We would recommend communicating directly with our support department, by opening a ticket with them. To do this, you would need to send an email to support@spamexperts.com
Please provide us the exact version of the cPanel so we can try to replicate this on our end.
v64.0 build 36
Did you test using "domain.com" or "$domain.com". The second value seems to be weird since cPanel will not consider it valid
domain.com - it was meant as a placeholder.
In your https://github.com/SpamExperts/cpanel-addon/blob/master/library/SpamFilter/Hooks.php#L558-L560 you echo out if (!$silent) echo "Deleting domain: {$domain['domain']}..";
- you cannot echo out things when doing hooks - it's supposed to be silent and only give a proper API response in case the system has to act on it.
A simple fix would to be sure that $silent
is set to true
when SpamExperts uses the hook system.
You cold however log the domains using your $this->_logger
which would make more sense anyway.
The issue couldn't be replicated on our testing server (cPanel & WHM 64.0 (build 36)). The account was terminated without any error.
How funny, I can replicate it on about 10 servers 👍
@lucasRolff, you're right. The hook's code does not conform to cPanel Standardized Hooks requirements.