HTTP API: Ensure cookie names are cast to strings.

Props nosilver4u, darssen, kraftbj, engahmeds3ed, barry.hughes, schlessera.
Fixes #58566.

git-svn-id: https://develop.svn.wordpress.org/trunk@57501 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Pascal Birchler
2024-01-31 12:51:39 +00:00
parent 1338984fb4
commit 7076ebbdd1
2 changed files with 54 additions and 2 deletions

View File

@@ -467,9 +467,9 @@ class WP_Http {
return null !== $attr;
}
);
$cookie_jar[ $value->name ] = new WpOrg\Requests\Cookie( $value->name, $value->value, $attributes, array( 'host-only' => $value->host_only ) );
$cookie_jar[ $value->name ] = new WpOrg\Requests\Cookie( (string) $value->name, $value->value, $attributes, array( 'host-only' => $value->host_only ) );
} elseif ( is_scalar( $value ) ) {
$cookie_jar[ $name ] = new WpOrg\Requests\Cookie( $name, (string) $value );
$cookie_jar[ $name ] = new WpOrg\Requests\Cookie( (string) $name, (string) $value );
}
}