Merge pull request #3516 from jitendrapurohit/CRM-14869
[civicrm-core.git] / CRM / Utils / Array.php
index 6518865625abfa0b04efbdc330690c4f59793b73..af0900da1e12e71fe8cf363b082d477612d39bd7 100644 (file)
@@ -706,9 +706,9 @@ class CRM_Utils_Array {
       $node = &$result;
       foreach ($keys as $key) {
         if (is_array($record)) {
-          $keyvalue = $record[$key];
+          $keyvalue = isset($record[$key]) ? $record[$key] : NULL;
         } else {
-          $keyvalue = $record->{$key};
+          $keyvalue = isset($record->{$key}) ? $record->{$key} : NULL;
         }
         if (isset($node[$keyvalue]) && !is_array($node[$keyvalue])) {
           $node[$keyvalue] = array();
@@ -878,6 +878,13 @@ class CRM_Utils_Array {
    * @return mixed
    *   The value found.
    */
+  /**
+   * @param $regexKey
+   * @param $list
+   * @param null $default
+   *
+   * @return null
+   */
   static function valueByRegexKey($regexKey, $list, $default = NULL) {
     if (is_array($list) && $regexKey) {
       $matches = preg_grep($regexKey, array_keys($list));