SDK for PHP V3

UriComparator
in package

FinalYes

Provides methods to determine if a modified URI should be considered cross-origin.

Tags
author

Graham Campbell

Table of Contents

Methods

isCrossOrigin()  : bool
Determines if a modified URI should be considered cross-origin with respect to an original URI.

Methods

isCrossOrigin()

Determines if a modified URI should be considered cross-origin with respect to an original URI.

public static isCrossOrigin(UriInterface $original, UriInterface $modified) : bool

Two URIs are cross-origin when their scheme, host, or effective port differ. Host comparison is case-insensitive, and bracketed IPv6 literals are canonicalized to their RFC 5952 form from any PSR-7 implementation before comparison, so equivalent spellings of the same address are same-origin. IPvFuture literals and bracketed values that cannot be parsed as an IPv6 address, such as those carrying zone identifiers, still compare as case-insensitive text. Missing ports use the default port for http, https, ws, or wss. Other schemes do not receive implicit default ports.

This helper only compares URI origins. It does not implement redirect handling or credential policy.

Parameters
$original : UriInterface
$modified : UriInterface
Return values
bool
<-- modeled_exceptions -->
On this page