• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed API Registration Spam Check

I'd like to replicate XenForo's spam check during registration through an API request. I have reviewed [bd] API and XenAPI and neither make use of XenForo_Model_SpamPrevention during the registration process. I have attempted to add this code:

$writer = XenForo_DataWriter::create('XenForo_DataWriter_User');
$spamModel = XenForo_Model::create('XenForo_Model_SpamPrevention');
$spamResponse = $spamModel->allowRegistration($writer->getMergedData(), new Zend_Controller_Request_Http());

The above code fails at $dataRegistryModel->set('dnsBlCache', $dnsBlCache); because "Message: Mysqli statement execute error : Lost connection to MySQL server during query." A var_dump of $dnsBlCache returns an array with 165040 elements.

@xfrocks @Contex
Last edited:


XenForo developer
Staff member
This is unrelated to those add-ons. It looks like there's a bug with expiration of this data. You can workaround it by just deleting the dnsBlCache row from the data registry table.
@Mike Thank you for looking into this. Is there any issue passing "new Zend_Controller_Request_Http()" instead of $this->_request as the second parameter to $spamModel->allowRegistration?