From: mark burdett Date: Wed, 26 Jul 2017 02:13:05 +0000 (-0700) Subject: CRM-20970 - avoid MySQL error caused by long numeric postal codes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=abc78dd48315dfb5684af52a47182bd894313e0e;p=civicrm-core.git CRM-20970 - avoid MySQL error caused by long numeric postal codes --- diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 2e4d34c074..5d1eeff495 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -3625,7 +3625,7 @@ WHERE $smartGroupClause // Handle numeric postal code range searches properly by casting the column as numeric if (is_numeric($value)) { - $field = "IF (civicrm_address.postal_code REGEXP '^[0-9]+$', CAST(civicrm_address.postal_code AS UNSIGNED), 0)"; + $field = "IF (civicrm_address.postal_code REGEXP '^[0-9]{1,10}$', CAST(civicrm_address.postal_code AS UNSIGNED), 0)"; $val = CRM_Utils_Type::escape($value, 'Integer'); } else {