Inherited a Cakephp application which uses a great deal of $this->redirect($url)
statements; all of them are followed by die();
as follows:
$this->redirect($url);
die();
I can only assume this is some poor form of error trapping, but I can't see why this would ever be necessary. $this->redirect
uses a URL redirect function from my framework, nothing our application has altered; if it doesn't work then my framework doesn't work, so nothing on the whole site would work in the first place. The die(); statements make it very hard to weed through the code and find where errors were expected (they're not using exceptions of course).
Is there any reason to keep these? The only functionality I can imagine they provide is to prevent execution of logic beyond a redirect in a function that wasn't supposed to execute, but it looks like bad unnecessary coding to me.