SecuredRedirectResponse::setTargetUrl

public SecuredRedirectResponse::setTargetUrl($url)

Sets the redirect target of this response.

Parameters

string $url The URL to redirect to:

Return value

RedirectResponse The current response.

Throws

\InvalidArgumentException

Overrides RedirectResponse::setTargetUrl

File

core/lib/Drupal/Component/HttpFoundation/SecuredRedirectResponse.php, line 54

Class

SecuredRedirectResponse
Provides a common base class for safe redirects.

Namespace

Drupal\Component\HttpFoundation

Code

public function setTargetUrl($url) {
  if (!$this->isSafe($url)) {
    throw new \InvalidArgumentException(sprintf('It is not safe to redirect to %s', $url));
  }
  return parent::setTargetUrl($url);
}
doc_Drupal
2016-10-29 09:40:59
Comments
Leave a Comment

Please login to continue.