From 9cb856d3d749060b6cf34a12d4137165c20146a7 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 19 Sep 2023 09:05:01 +1200 Subject: [PATCH] Case _action to an int There is a lot of code comparing to action which is unsure whether it is dealing with 2 or '2'. It should be possible to always cast to an int but I have added deprecation just in case... --- CRM/Core/Form.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index d02840cd44..f9077663f0 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1312,7 +1312,11 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * @return int */ public function getAction() { - return $this->_action; + if (!is_numeric($this->_action)) { + CRM_Core_Error::deprecatedWarning('action should be an integer'); + return $this->_action; + } + return (int) $this->_action; } /** @@ -1322,7 +1326,13 @@ class CRM_Core_Form extends HTML_QuickForm_Page { * The mode we want to set the form. */ public function setAction($action) { - $this->_action = $action; + if (is_numeric($action)) { + $this->_action = (int) $action; + } + else { + CRM_Core_Error::deprecatedWarning('action should be an integer'); + $this->_action = $action; + } } /** -- 2.25.1