[REF][PHP8.1] Fix issues in core extensions where passing in NULL values is no longer...
authorSeamus Lee <seamuslee001@gmail.com>
Wed, 13 Jul 2022 23:43:15 +0000 (09:43 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Wed, 13 Jul 2022 23:43:15 +0000 (09:43 +1000)
ext/afform/core/afform.php
ext/legacycustomsearches/CRM/Contact/Form/Search/Custom/FullText.php
ext/oauth-client/Civi/Api4/Action/OAuthContactToken/Create.php
ext/search_kit/Civi/Api4/Action/SearchDisplay/AbstractRunAction.php

index 19f86de1ad57c929ac686fe759cb71cbd619869c..be15c8f32277c0abc031cd07976b944267fab3de 100644 (file)
@@ -466,13 +466,13 @@ function _afform_angular_module_name($fileBaseName, $format = 'camel') {
   switch ($format) {
     case 'camel':
       $camelCase = '';
-      foreach (preg_split('/[-_ ]/', $fileBaseName, NULL, PREG_SPLIT_NO_EMPTY) as $shortNamePart) {
+      foreach (preg_split('/[-_ ]/', $fileBaseName, -1, PREG_SPLIT_NO_EMPTY) as $shortNamePart) {
         $camelCase .= ucfirst($shortNamePart);
       }
       return strtolower($camelCase[0]) . substr($camelCase, 1);
 
     case 'dash':
-      return strtolower(implode('-', preg_split('/[-_ ]|(?=[A-Z])/', $fileBaseName, NULL, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE)));
+      return strtolower(implode('-', preg_split('/[-_ ]|(?=[A-Z])/', $fileBaseName, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE)));
 
     default:
       throw new \Exception("Unrecognized format");
index 64cb9ba3c4c0326a02db4139cf0aa50bd4297a42..9619ff36c45a86a42757fe3c5fc8c9cc39dd59f7 100644 (file)
@@ -93,7 +93,7 @@ class CRM_Contact_Form_Search_Custom_FullText extends CRM_Contact_Form_Search_Cu
     $formValues['table'] = $this->getFieldValue($formValues, 'table', 'String');
     $this->_table = $formValues['table'];
 
-    $formValues['text'] = trim($this->getFieldValue($formValues, 'text', 'String', ''));
+    $formValues['text'] = trim($this->getFieldValue($formValues, 'text', 'String', '') ?? '');
     $this->_text = $formValues['text'];
 
     if (!$this->_table) {
index 78055ededf3bbc13668a1e37823be9ed72cb6d80..ddb03ce3b78b32197f6750dcdee673a386221e0c 100644 (file)
@@ -18,7 +18,7 @@ class Create extends \Civi\Api4\Generic\DAOCreateAction {
       return;
     }
 
-    $tag = $this->values['tag'] ?? NULL;
+    $tag = $this->values['tag'] ?? '';
 
     if ('linkContact:' === substr($tag, 0, 12)) {
       $this->values['contact_id'] = substr($tag, 12);
index 157bd2f90087896b6e384ad849baadbef0007156..59c209f8181369f22c23343df5d3109e11bb66b8 100644 (file)
@@ -722,7 +722,7 @@ abstract class AbstractRunAction extends \Civi\Api4\Generic\AbstractAction {
    * @return string
    */
   private function replaceTokens($tokenExpr, $data, $format, $index = 0) {
-    if (strpos($tokenExpr, '[') !== FALSE) {
+    if (strpos(($tokenExpr ?? ''), '[') !== FALSE) {
       foreach ($this->getTokens($tokenExpr) as $token) {
         $val = $data[$token] ?? NULL;
         if (isset($val) && $format === 'view') {
@@ -733,7 +733,7 @@ abstract class AbstractRunAction extends \Civi\Api4\Generic\AbstractAction {
         if ($format === 'url' && (!isset($replacement) || $replacement === '')) {
           return NULL;
         }
-        $tokenExpr = str_replace('[' . $token . ']', $replacement, $tokenExpr);
+        $tokenExpr = str_replace('[' . $token . ']', ($replacement ?? ''), ($tokenExpr ?? ''));
       }
     }
     return $tokenExpr;