From db8b6a43e0cabefc39b4d693a438f7bee5ec1d95 Mon Sep 17 00:00:00 2001 From: Manuel Lingureanu Date: Fri, 31 Mar 2017 23:39:55 +0300 Subject: [PATCH 1/2] Update WizardComponent.php test type for $proceed --- Controller/Component/WizardComponent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Controller/Component/WizardComponent.php b/Controller/Component/WizardComponent.php index 735d265..9f80583 100644 --- a/Controller/Component/WizardComponent.php +++ b/Controller/Component/WizardComponent.php @@ -382,7 +382,7 @@ public function process($step) { } else { throw new NotImplementedException(sprintf(__('Process Callback not found. Please create Controller::%s', $processCallback))); } - if ($proceed) { + if ($proceed === true) { $this->save(); if (isset($this->controller->request->data['SaveAndBack']) && prev($this->steps)) { return $this->redirect(current($this->steps)); From 1484bfcf1b23d182e53619e610a1b21d57d62c83 Mon Sep 17 00:00:00 2001 From: Manuel Lingureanu Date: Tue, 11 Apr 2017 12:46:41 +0300 Subject: [PATCH 2/2] Update WizardComponent.php --- Controller/Component/WizardComponent.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Controller/Component/WizardComponent.php b/Controller/Component/WizardComponent.php index 9f80583..be64e3f 100644 --- a/Controller/Component/WizardComponent.php +++ b/Controller/Component/WizardComponent.php @@ -377,12 +377,15 @@ public function process($step) { $processCallback = Inflector::variable('process_' . $this->_currentStep); if (method_exists($this->controller, $processCallback)) { $proceed = $this->controller->$processCallback(); + if (!is_bool($proceed)) { + throw new NotImplementedException(sprintf(__('Process Callback Controller::%s should return boolean', $processCallback))); + } } elseif ($this->autoValidate) { $proceed = $this->_validateData(); } else { throw new NotImplementedException(sprintf(__('Process Callback not found. Please create Controller::%s', $processCallback))); } - if ($proceed === true) { + if ($proceed) { $this->save(); if (isset($this->controller->request->data['SaveAndBack']) && prev($this->steps)) { return $this->redirect(current($this->steps));