Throw exception if id not passed into discard
authoreileen <emcnaughton@wikimedia.org>
Sat, 20 Jun 2020 01:13:13 +0000 (13:13 +1200)
committereileen <emcnaughton@wikimedia.org>
Sat, 20 Jun 2020 01:13:13 +0000 (13:13 +1200)
https://lab.civicrm.org/dev/drupal/-/issues/123 - may not be related but this seems a good precaution

CRM/Contact/BAO/Group.php

index 0722920a6f79df2eddd98a38bff55220c9293fd5..8ce1289fae26a7a22a2aeef09ebfb4529566f03e 100644 (file)
@@ -52,6 +52,9 @@ class CRM_Contact_BAO_Group extends CRM_Contact_DAO_Group {
    * @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();