avoid type error in CRM_Core_Form on php 8
authorNoah Miller <nm@lemnisc.us>
Fri, 17 Mar 2023 03:20:27 +0000 (23:20 -0400)
committerNoah Miller <nm@lemnisc.us>
Fri, 17 Mar 2023 03:20:27 +0000 (23:20 -0400)
CRM/Case/Form/Case.php
CRM/Core/Form.php

index 76800a435858fd1dfcadb0e4fd72819b39cb85e9..da3c6cda7be5d0e8e98c786b58ec33f96fc3d494 100644 (file)
@@ -198,7 +198,7 @@ class CRM_Case_Form_Case extends CRM_Core_Form {
   /**
    * Set default values for the form.
    */
-  public function setDefaultValues() {
+  public function setDefaultValues(): array {
     if ($this->_action & CRM_Core_Action::DELETE || $this->_action & CRM_Core_Action::RENEW) {
       return [];
     }
index c3682d97b43185a5ddb52ee95aaa98d6bd3c4775..032c89b8d901c8522f017ac1a38027a4613b4baa 100644 (file)
@@ -694,7 +694,9 @@ class CRM_Core_Form extends HTML_QuickForm_Page {
     $this->buildQuickForm();
 
     $defaults = $this->setDefaultValues();
-    unset($defaults['qfKey']);
+    if (isset($defaults['qfKey'])) {
+      unset($defaults['qfKey']);
+    }
 
     if (!empty($defaults)) {
       $this->setDefaults($defaults);