summaryrefslogtreecommitdiffstats
path: root/wp-includes/Requests/src/Cookie.php
diff options
context:
space:
mode:
Diffstat (limited to 'wp-includes/Requests/src/Cookie.php')
-rw-r--r--wp-includes/Requests/src/Cookie.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/wp-includes/Requests/src/Cookie.php b/wp-includes/Requests/src/Cookie.php
index 6f971d6..2cc821d 100644
--- a/wp-includes/Requests/src/Cookie.php
+++ b/wp-includes/Requests/src/Cookie.php
@@ -470,13 +470,19 @@ class Cookie {
* @param \WpOrg\Requests\Iri|null $origin URI for comparing cookie origins
* @param int|null $time Reference time for expiration calculation
* @return array
+ *
+ * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $origin argument is not null or an instance of the Iri class.
*/
- public static function parse_from_headers(Headers $headers, Iri $origin = null, $time = null) {
+ public static function parse_from_headers(Headers $headers, $origin = null, $time = null) {
$cookie_headers = $headers->getValues('Set-Cookie');
if (empty($cookie_headers)) {
return [];
}
+ if ($origin !== null && !($origin instanceof Iri)) {
+ throw InvalidArgument::create(2, '$origin', Iri::class . ' or null', gettype($origin));
+ }
+
$cookies = [];
foreach ($cookie_headers as $header) {
$parsed = self::parse($header, '', $time);