From f16e658b081eaf3e95125f983fc19caa210a63d3 Mon Sep 17 00:00:00 2001 From: colemanw Date: Thu, 7 Sep 2023 13:38:12 -0400 Subject: [PATCH] PseudoConstant - Prevent fatal when entity not available This can happen e.g when Views tries to lookup an option value for a disabled extension. See https://github.com/civicrm/civicrm-drupal/pull/656#issuecomment-1094362139 --- CRM/Core/PseudoConstant.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index 17dd76dbe1..4a86234f1f 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -209,8 +209,10 @@ class CRM_Core_PseudoConstant { } // Core field: load schema - $dao = new $daoName(); - $fieldSpec = $dao->getFieldSpec($fieldName); + if (class_exists($daoName)) { + $dao = new $daoName(); + $fieldSpec = $dao->getFieldSpec($fieldName); + } // Return false if field doesn't exist. if (empty($fieldSpec)) { -- 2.25.1