diff --git a/app/Controller/PagesController.php b/app/Controller/PagesController.php index fd2398a4d..dd723c539 100644 --- a/app/Controller/PagesController.php +++ b/app/Controller/PagesController.php @@ -56,7 +56,7 @@ class PagesController extends AppController { $count = count($path); if (!$count) { - $this->redirect('/'); + return $this->redirect('/'); } $page = $subpage = $title_for_layout = null; diff --git a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp index e3df02186..ecc3363ad 100644 --- a/lib/Cake/Console/Templates/default/actions/controller_actions.ctp +++ b/lib/Cake/Console/Templates/default/actions/controller_actions.ctp @@ -58,13 +58,12 @@ $this->Session->setFlash(__('The has been saved')); return $this->redirect(array('action' => 'index')); - $this->flash(__(' saved.'), array('action' => 'index')); - - } else { - - $this->Session->setFlash(__('The could not be saved. Please, try again.')); + return $this->flash(__(' saved.'), array('action' => 'index')); } + + $this->Session->setFlash(__('The could not be saved. Please, try again.')); + } Session->setFlash(__('The has been saved')); return $this->redirect(array('action' => 'index')); - $this->flash(__('The has been saved.'), array('action' => 'index')); - - } else { - - $this->Session->setFlash(__('The could not be saved. Please, try again.')); + return $this->flash(__('The has been saved.'), array('action' => 'index')); } + + $this->Session->setFlash(__('The could not be saved. Please, try again.')); + } else { $options = array('conditions' => array('.' . $this->->primaryKey => $id)); $this->request->data = $this->->find('first', $options); @@ -147,13 +145,13 @@ $this->Session->setFlash(__(' deleted')); return $this->redirect(array('action' => 'index')); - $this->flash(__(' deleted'), array('action' => 'index')); + return $this->flash(__(' deleted'), array('action' => 'index')); } $this->Session->setFlash(__(' was not deleted')); - $this->flash(__(' was not deleted'), array('action' => 'index')); + return $this->flash(__(' was not deleted'), array('action' => 'index')); return $this->redirect(array('action' => 'index')); } diff --git a/lib/Cake/Console/Templates/skel/Controller/PagesController.php b/lib/Cake/Console/Templates/skel/Controller/PagesController.php index 2b2903050..7b4e45a8f 100644 --- a/lib/Cake/Console/Templates/skel/Controller/PagesController.php +++ b/lib/Cake/Console/Templates/skel/Controller/PagesController.php @@ -57,7 +57,7 @@ class PagesController extends AppController { $count = count($path); if (!$count) { - $this->redirect('/'); + return $this->redirect('/'); } $page = $subpage = $title_for_layout = null; diff --git a/lib/Cake/Controller/Scaffold.php b/lib/Cake/Controller/Scaffold.php index c63ab7b32..af1f3c940 100644 --- a/lib/Cake/Controller/Scaffold.php +++ b/lib/Cake/Controller/Scaffold.php @@ -329,10 +329,9 @@ class Scaffold { protected function _sendMessage($message) { if ($this->_validSession) { $this->controller->Session->setFlash($message); - $this->controller->redirect($this->redirect); - } else { - $this->controller->flash($message, $this->redirect); + return $this->controller->redirect($this->redirect); } + $this->controller->flash($message, $this->redirect); } /** diff --git a/lib/Cake/Test/test_app/Controller/PagesController.php b/lib/Cake/Test/test_app/Controller/PagesController.php index c1e60e3f1..98b2ed779 100644 --- a/lib/Cake/Test/test_app/Controller/PagesController.php +++ b/lib/Cake/Test/test_app/Controller/PagesController.php @@ -57,7 +57,7 @@ class PagesController extends AppController { $count = count($path); if (!$count) { - $this->redirect('/'); + return $this->redirect('/'); } $page = $subpage = $titleForLayout = null; diff --git a/lib/Cake/Test/test_app/Controller/TestsAppsController.php b/lib/Cake/Test/test_app/Controller/TestsAppsController.php index cc0028246..d75b8ed39 100644 --- a/lib/Cake/Test/test_app/Controller/TestsAppsController.php +++ b/lib/Cake/Test/test_app/Controller/TestsAppsController.php @@ -49,7 +49,7 @@ class TestsAppsController extends AppController { } public function redirect_to() { - $this->redirect('http://cakephp.org'); + return $this->redirect('http://cakephp.org'); } }