Wrong class name in XML schema causes CRM core crash
After upgrading CiviCRM from 5.66 to 5.72, the contribution pages on our website (not related to grant applications) no longer work. Attempting to submit the page results in the following error:
Class "CRM_Grantapplications_DAO_GrantApplicationPage" not found
in /home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php at line 2692
#0 /home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php(2717): CRM_Core_DAO::getReferencesToTable()
#1 /home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Dedupe/BAO/DedupeRule.php(70): CRM_Core_DAO::getReferencesToContactTable()
...
(rest of call stack omitted for brevity)
The issue seems to be in xml/schema/CRM/Grantapplications/GrantApplicationPage.entityType.php
, which has the wrong class name in it:
// This file declares a new entity type. For more details, see "hook_civicrm_entityTypes" at:
// https://docs.civicrm.org/dev/en/latest/hooks/hook_civicrm_entityTypes
return [
[
'name' => 'GrantApplicationPage',
'class' => 'CRM_Grantapplications_DAO_GrantApplicationPage', // THIS IS WRONG! -> should be CRM_Grant_DAO_GrantApplicationPage
'table' => 'civicrm_grant_application_page', // also wrong -> should be civicrm_grant_app_page
],
];
Updating these values to match those given in grantapplications_civicrm_entityTypes()
seems to fix the issue.
I will raise a PR to fix this, but I wonder if the file should also be moved to xml/schema/CRM/Grant
to follow the correct naming convention?