From 29d68d51a6dfe30ac0e6f37eff01cfafacf45bfc Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 20 Jun 2020 13:13:13 +1200 Subject: [PATCH] Throw exception if id not passed into discard https://lab.civicrm.org/dev/drupal/-/issues/123 - may not be related but this seems a good precaution --- CRM/Contact/BAO/Group.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CRM/Contact/BAO/Group.php b/CRM/Contact/BAO/Group.php index 0722920a6f79..8ce1289fae26 100644 --- a/CRM/Contact/BAO/Group.php +++ b/CRM/Contact/BAO/Group.php @@ -52,6 +52,9 @@ public static function retrieve(&$params, &$defaults) { * @param int $id Group id. */ public static function discard($id) { + if (!$id || !is_numeric($id)) { + throw new CRM_Core_Exception('Invalid group request attempted'); + } CRM_Utils_Hook::pre('delete', 'Group', $id, CRM_Core_DAO::$_nullArray); $transaction = new CRM_Core_Transaction();