Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-18504: Fix error in validating sub type by entity #8301

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CRM/Core/BAO/CustomGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -652,13 +652,13 @@ protected static function validateSubTypeByEntity($entityType, $subType) {
return $subType;
}
$contactTypes = civicrm_api3('Contact', 'getoptions', array('field' => 'contact_type'));
if ($entityType != 'Contact' && !in_array($entityType, $contactTypes['values'])) {
if ($entityType != 'Contact' && !array_key_exists($entityType, $contactTypes['values'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line replicated/merged via eileen's #8389.

The other change is not replicated merged there.

// Not quite sure if we want to fail this hard. But quiet ignore would be pretty bad too.
// Am inclined to go with this for RC release & considering softening.
throw new CRM_Core_Exception('Invalid Entity Filter');
}
$subTypes = civicrm_api3('Contact', 'getoptions', array('field' => 'contact_sub_type'));
if (!isset($subTypes['values'][$subType])) {
if (!array_key_exists($subType, $subTypes['values'])) {
// Same comments about fail hard as above.
throw new CRM_Core_Exception('Invalid Filter');
}
Expand Down