rebase on oct-10-2023
This commit is contained in:
@@ -115,7 +115,7 @@ class WP_Http_Cookie {
|
||||
$this->domain = $parsed_url['host'];
|
||||
}
|
||||
$this->path = isset( $parsed_url['path'] ) ? $parsed_url['path'] : '/';
|
||||
if ( '/' !== substr( $this->path, -1 ) ) {
|
||||
if ( ! str_ends_with( $this->path, '/' ) ) {
|
||||
$this->path = dirname( $this->path ) . '/';
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class WP_Http_Cookie {
|
||||
foreach ( $pairs as $pair ) {
|
||||
$pair = rtrim( $pair );
|
||||
|
||||
// Handle the cookie ending in ; which results in a empty final pair.
|
||||
// Handle the cookie ending in ; which results in an empty final pair.
|
||||
if ( empty( $pair ) ) {
|
||||
continue;
|
||||
}
|
||||
@@ -202,8 +202,8 @@ class WP_Http_Cookie {
|
||||
}
|
||||
|
||||
// Host - very basic check that the request URL ends with the domain restriction (minus leading dot).
|
||||
$domain = ( '.' === substr( $domain, 0, 1 ) ) ? substr( $domain, 1 ) : $domain;
|
||||
if ( substr( $url['host'], -strlen( $domain ) ) !== $domain ) {
|
||||
$domain = ( str_starts_with( $domain, '.' ) ) ? substr( $domain, 1 ) : $domain;
|
||||
if ( ! str_ends_with( $url['host'], $domain ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ class WP_Http_Cookie {
|
||||
}
|
||||
|
||||
// Path - request path must start with path restriction.
|
||||
if ( substr( $url['path'], 0, strlen( $path ) ) !== $path ) {
|
||||
if ( ! str_starts_with( $url['path'], $path ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user