12) Call exit() after redirecting
This should be no surprise to anyone who has done any serious web development in the past, but make sure you call exit() after running $this->redirect() if there’s code afterward that you don’t want to run. I’ve always done this in the past, but I made the assumption that $this->redirect() would make an exit call for me (which it didn’t).
stimmt es, dass der redirect call kein autmatisches exit herbeiruft? auch in der aktuellsten Version von CAKEPHP?
man also statt
$this->redirect(array('action'=>'index'));
besser
$this->redirect(array('action'=>'index')); exit;
schreiben sollte? damit kein weiterer Code ausgeführt wird?
eigentlich, wenn ichs mir so überlege, kann ja danach nichts ausgeführt werden, weil die funktion ja erst wieder etwas zurückgeben muss
das kann sie aber nicht, weil ja dann weitergeleitet wird
insofern ist das, was diese person geschrieben hat, ja eigentlich hinfällig
auch wenn ich es früher ebenso gemacht habe, lieber einmal zuviel als zu wenig (doppelt hält ja besser)
PS: auf der Seite stehen noch n paar andere Tipps
einige sind echt interessant