Deprecate passing in silly data
authoreileen <emcnaughton@wikimedia.org>
Tue, 17 Mar 2020 02:44:01 +0000 (15:44 +1300)
committereileen <emcnaughton@wikimedia.org>
Tue, 17 Mar 2020 02:44:01 +0000 (15:44 +1300)
Later we can move to requiring an integer

CRM/Contact/BAO/Contact.php

index 82eb740b62ea2b69ef0e555d34863ee53796f99c..dfa83259825006e4e18256e63e450e55956845bd 100644 (file)
@@ -917,10 +917,14 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
    *
    * @return bool
    *   Was contact deleted?
+   *
+   * @throws \CRM_Core_Exception
+   * @throws \CiviCRM_API3_Exception
    */
   public static function deleteContact($id, $restore = FALSE, $skipUndelete = FALSE, $checkPermissions = TRUE) {
 
-    if (!$id) {
+    if (!$id || !is_numeric($id)) {
+      CRM_Core_Error::deprecatedFunctionWarning('calling delete contact without a valid contact ID is deprecated.');
       return FALSE;
     }
     // If trash is disabled in system settings then we always skip