CRM-17646 - Add hook_civicrm_fieldOptions + tests
[civicrm-core.git] / CRM / Utils / Signer.php
index 881c710b41da0930cf0437d23aeeca92571fdd1a..25c382af58bff9afa3f53f7ed20115179bfbe4e3 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.6                                                |
+ | CiviCRM version 4.7                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2015                                |
  +--------------------------------------------------------------------+
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
  */
 
 /**
@@ -99,7 +97,8 @@ class CRM_Utils_Signer {
           $params[$paramName] = (string) $params[$paramName];
         }
       }
-      else {// $paramName is not included or ===NULL
+      else {
+        // $paramName is not included or ===NULL
         $params[$paramName] = '';
       }
       $message['payload'][$paramName] = $params[$paramName];
@@ -122,7 +121,7 @@ class CRM_Utils_Signer {
   public function validate($token, $params) {
     list ($salt, $signature) = explode($this->signDelim, $token);
     if (strlen($salt) != self::SALT_LEN) {
-      throw new Exception("Invalid salt [$token]=[$salt][$signature]");
+      throw new Exception("Token contains invalid salt [" . urlencode($token) . "]");
     }
     $newToken = $this->sign($params, $salt);
     return ($token == $newToken);