Fix passing a non-array to CRM_Utils_Array::value
authoreileen <emcnaughton@wikimedia.org>
Fri, 6 Mar 2020 20:33:02 +0000 (09:33 +1300)
committereileen <emcnaughton@wikimedia.org>
Fri, 6 Mar 2020 23:48:06 +0000 (12:48 +1300)
As surfaced in https://test.civicrm.org/job/CiviCRM-Core-PR/32543/console when we tested deprecating
passing in a non-array

CRM/Core/Menu.php

index f370b8cacb6b16e642f31bb5639fa8d68f7b2add..9b767aeb97746a108464b9d596c725fb8cc8e5a9 100644 (file)
@@ -227,9 +227,10 @@ class CRM_Core_Menu {
 
       foreach ($fieldsToPropagate as $field) {
         if (!$fieldsPresent[$field]) {
-          if (CRM_Utils_Array::value($field, CRM_Utils_Array::value($parentPath, $menu)) !== NULL) {
+          $fieldInParentMenu = $menu[$parentPath][$field] ?? NULL;
+          if ($fieldInParentMenu !== NULL) {
             $fieldsPresent[$field] = TRUE;
-            $menu[$path][$field] = $menu[$parentPath][$field];
+            $menu[$path][$field] = $fieldInParentMenu;
           }
         }
       }