You are here

public function UriSigner::check in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/http-kernel/UriSigner.php \Symfony\Component\HttpKernel\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

bool True if the URI is signed correctly, false otherwise

File

vendor/symfony/http-kernel/UriSigner.php, line 68

Class

UriSigner
Signs URIs.

Namespace

Symfony\Component\HttpKernel

Code

public function check($uri) {
  $url = parse_url($uri);
  if (isset($url['query'])) {
    parse_str($url['query'], $params);
  }
  else {
    $params = array();
  }
  if (empty($params['_hash'])) {
    return false;
  }
  $hash = urlencode($params['_hash']);
  unset($params['_hash']);
  return $this
    ->computeHash($this
    ->buildUrl($url, $params)) === $hash;
}