Make WordPress Core

Changeset 57876


Ignore:
Timestamp:
03/25/2024 12:21:36 PM (3 years ago)
Author:
swissspidy
Message:

External Libraries: Update the Requests library to version 2.0.11.

This is a maintenance release with two minor fixes to improve PHP 8.4 compatibility.

References:

Follow-up to [56554], [54997], [55007], [55046], [55225], [55296], [55629].

Props swissspidy, jrf.
Fixes #60838.

Location:
trunk/src/wp-includes/Requests/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/Requests/src/Cookie.php

    r55629 r57876  
    471471         * @param int|null $time Reference time for expiration calculation
    472472         * @return array
    473          */
    474         public static function parse_from_headers(Headers $headers, Iri $origin = null, $time = null) {
     473         *
     474         * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $origin argument is not null or an instance of the Iri class.
     475         */
     476        public static function parse_from_headers(Headers $headers, $origin = null, $time = null) {
    475477                $cookie_headers = $headers->getValues('Set-Cookie');
    476478                if (empty($cookie_headers)) {
    477479                        return [];
     480                }
     481
     482                if ($origin !== null && !($origin instanceof Iri)) {
     483                        throw InvalidArgument::create(2, '$origin', Iri::class . ' or null', gettype($origin));
    478484                }
    479485
  • trunk/src/wp-includes/Requests/src/Requests.php

    r57086 r57876  
    149149         * @var string
    150150         */
    151         const VERSION = '2.0.9';
     151        const VERSION = '2.0.11';
    152152
    153153        /**
  • trunk/src/wp-includes/Requests/src/Transport/Fsockopen.php

    r55629 r57876  
    145145                        }
    146146
    147                         stream_context_set_option($context, ['ssl' => $context_options]);
     147                        // Handle the PHP 8.4 deprecation (PHP 9.0 removal) of the function signature we use for stream_context_set_option().
     148                        // Ref: https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#stream_context_set_option
     149                        if (function_exists('stream_context_set_options')) {
     150                                // PHP 8.3+.
     151                                stream_context_set_options($context, ['ssl' => $context_options]);
     152                        } else {
     153                                // PHP < 8.3.
     154                                stream_context_set_option($context, ['ssl' => $context_options]);
     155                        }
    148156                } else {
    149157                        $remote_socket = 'tcp://' . $host;
Note: See TracChangeset for help on using the changeset viewer.