public function UriSigner::check

Checks that a URI contains the correct hash.

The _hash query string parameter must be the last one (as it is generated that way by the sign() method, it should never be a problem).

Parameters

string $uri A signed URI:

Return value

Boolean True if the URI is signed correctly, false otherwise

File

drupal/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/UriSigner.php, line 59

Class

UriSigner
Signs URIs.

Namespace

Symfony\Component\HttpKernel

Code

public function check($uri) {
  if (!preg_match('/^(.*)(?:\\?|&)_hash=(.+?)$/', $uri, $matches)) {
    return false;
  }
  return $this
    ->computeHash($matches[1]) === $matches[2];
}