summaryrefslogtreecommitdiffstats
path: root/wp-includes/Requests/src
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:51:18 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-09-19 04:51:18 +0000
commit0e41b5d52fdc6af6442816b5f465c9db9f84e126 (patch)
treee139a90049b158d4eed892d1662ee7f5c358fa31 /wp-includes/Requests/src
parentAdding upstream version 6.5.5+dfsg1. (diff)
downloadwordpress-upstream.tar.xz
wordpress-upstream.zip
Adding upstream version 6.6.1+dfsg1.upstream/6.6.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--wp-includes/Requests/src/Cookie.php8
-rw-r--r--wp-includes/Requests/src/Requests.php2
-rw-r--r--wp-includes/Requests/src/Transport/Fsockopen.php10
3 files changed, 17 insertions, 3 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);
diff --git a/wp-includes/Requests/src/Requests.php b/wp-includes/Requests/src/Requests.php
index bb5292a..5c6f13e 100644
--- a/wp-includes/Requests/src/Requests.php
+++ b/wp-includes/Requests/src/Requests.php
@@ -148,7 +148,7 @@ class Requests {
*
* @var string
*/
- const VERSION = '2.0.9';
+ const VERSION = '2.0.11';
/**
* Selected transport name
diff --git a/wp-includes/Requests/src/Transport/Fsockopen.php b/wp-includes/Requests/src/Transport/Fsockopen.php
index 2b53d0c..6bd82a3 100644
--- a/wp-includes/Requests/src/Transport/Fsockopen.php
+++ b/wp-includes/Requests/src/Transport/Fsockopen.php
@@ -144,7 +144,15 @@ final class Fsockopen implements Transport {
$verifyname = false;
}
- stream_context_set_option($context, ['ssl' => $context_options]);
+ // Handle the PHP 8.4 deprecation (PHP 9.0 removal) of the function signature we use for stream_context_set_option().
+ // Ref: https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#stream_context_set_option
+ if (function_exists('stream_context_set_options')) {
+ // PHP 8.3+.
+ stream_context_set_options($context, ['ssl' => $context_options]);
+ } else {
+ // PHP < 8.3.
+ stream_context_set_option($context, ['ssl' => $context_options]);
+ }
} else {
$remote_socket = 'tcp://' . $host;
}