« Return to Thread: 403 HTTP Status Code with Redirector action helper

403 HTTP Status Code with Redirector action helper

by Hector Virgen :: Rate this Message:

Reply to Author | View in Thread

Hello,

I'm having trouble with the "Redirector" action helper. If I set the the status code to 403 (forbidden), the redirector throws an exception:

"Invalid redirect HTTP status code (403)"

I searched the issue tracker for this and didn't find anything regarding setCode().

I am using RFC 2616 status codes: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

Error code 404 seems to work without problems.

Here is some code to reproduce the error:

<?php

class FooAction extends Zend_Controller_Action
{
    public function preDispatch()
    {
        $redirector = $this->_getHelper('Redirector');
        $redirector->setCode(403); // throws exception
        $redirector->goto('index'); // never gets here
    }
}

Is there a reason why I can't use 403? If so, are there other status codes that I cannot use with the redirector? Thanks for your time :)

-Hector

 « Return to Thread: 403 HTTP Status Code with Redirector action helper