Invalid HTTP response code

silence

Well-known member
I'm just triggering an error in ControllerPublic, nothing really special, using this:
PHP:
            //Check time interval for dancing
            if ($dancePeriod = $model->danceFloodCheck() > 0)
            {
                return $this->responseError(new XenForo_Phrase('dance_interval_check'), array('seconds' => $dancePeriod));
            }
And I'm getting this strange error:
PHP:
An exception occurred: Invalid HTTP response code in /public_html/xenforo/library/Zend/Controller/Response/Abstract.php on line 286

    Zend_Controller_Response_Abstract->setHttpResponseCode() in XenForo/FrontController.php at line 555
    XenForo_FrontController->renderView() in XenForo/FrontController.php at line 158
    XenForo_FrontController->run() in /public_html/xenforo/index.php at line 13
 
The second argument to responseError is a status code. You've defined an array. Presumably, you wanted that within the XenForo_Phrase constructor.
 
The second argument to responseError is a status code. You've defined an array. Presumably, you wanted that within the XenForo_Phrase constructor.
Ah got it. Well the error is gone but it's not showing the parameters right.
Code:
You are dancing too fast! Please wait {seconds} second(s).
Also I was basing my original code from the XF function in XenForo_Controller:
PHP:
    public function responseFlooding($floodSeconds)
    {
        return $this->responseError(new XenForo_Phrase('must_wait_x_seconds_before_performing_this_action', array('count' => $floodSeconds)));
    }
 
You are using {seconds} in your phrase, but you are assigning the data to {count}.
No my second post is a snippet from XenForo_Controller class. My function that is causing this error is the first post. Sorry for the misunderstanding!
 
Well for one, your $dancePeriod variable is a boolean:

PHP:
$dancePeriod = $model->danceFloodCheck() > 0 // true || false

$dancePeriod = $model>danceFloodCheck(); // int
if ($dancePeriod > 0) // true || false
 
Top Bottom