diff --git a/src/Pluf/AB.php b/src/Pluf/AB.php index ab8d3c9..239b47b 100644 --- a/src/Pluf/AB.php +++ b/src/Pluf/AB.php @@ -171,7 +171,7 @@ class Pluf_AB * @param $request Pluf_HTTP_Request * @param $props array Properties */ - public static function register($request, $props) + public static function register(&$request, $props) { $pabuid = (isset($request->pabuid)) ? $request->pabuid : diff --git a/src/Pluf/Sign.php b/src/Pluf/Sign.php index 66e5ff6..ef2f212 100644 --- a/src/Pluf/Sign.php +++ b/src/Pluf/Sign.php @@ -145,12 +145,16 @@ class Pluf_Sign if ($key === null) { $key = Pluf::f('secret_key'); } + $compressed = ($signed_value[0] == '.') ? '.' : ''; + if ($compressed) { + $signed_value = substr($signed_value, 1); + } if (false === strpos($signed_value, '.')) { throw new Exception('Missing signature (no . found in value).'); } list($value, $sig) = explode('.', $signed_value, 2); - if (self::base64_hmac($value, $key) == $sig) { - return $value; + if (self::base64_hmac($compressed.$value, $key) == $sig) { + return $compressed.$value; } else { throw new Exception(sprintf('Signature failed: "%s".', $sig)); }