I am upgrading an application from cakephp 1.3 to 2.0 and running into some problems. I can’t quite figure out what is going on behind the scenes with my redirect statements. This has been happening since I ran the upgrade shell.
If I put this in my controller the redirect works perfectly:
function redirect() {
$this->redirect(array('controller' => 'user', 'action' => 'partners'));
}
This, however, does not work for me:
function redirect2() {
echo 'made it';
$this->redirect(array('controller' => 'user', 'action' => 'partners'));
}
This isn’t a function I am using, it is just the simplest form of the problem I have isolated.
I know I shouldn’t be displaying things from the controller, but my question is what is going on behind the scenes that is causing the redirect to not function? The result for the redirect2() is it prints “made it” on the screen and then stops. No errors, no redirects, no showing the view for redirect2. I have checked the error logs and there are no errors.
The confusing thing is that when I was using 1.3 all my redirects worked fine, and now something isn’t working with some of them.
Thanks for any help,
you are not allowed to echo anything except for http headers prior to a php redirect.