Changeset 55629
- Timestamp:
- 04/05/2023 01:10:53 PM (18 months ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/Requests/src/Autoload.php
r54997 r55629 167 167 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error 168 168 trigger_error( 169 'The PSR-0 `Requests_...` class names in the Request library are deprecated.'169 'The PSR-0 `Requests_...` class names in the Requests library are deprecated.' 170 170 . ' Switch to the PSR-4 `WpOrg\Requests\...` class names at your earliest convenience.', 171 171 E_USER_DEPRECATED -
trunk/src/wp-includes/Requests/src/Capability.php
r54997 r55629 29 29 * Note: this does not automatically mean that the capability will be supported for your chosen transport! 30 30 * 31 * @var array<string>31 * @var string[] 32 32 */ 33 33 const ALL = [ -
trunk/src/wp-includes/Requests/src/Cookie.php
r54997 r55629 37 37 * Cookie attributes 38 38 * 39 * Valid keys are (currently) path, domain, expires, max-age, secureand40 * httponly.39 * Valid keys are `'path'`, `'domain'`, `'expires'`, `'max-age'`, `'secure'` and 40 * `'httponly'`. 41 41 * 42 42 * @var \WpOrg\Requests\Utility\CaseInsensitiveDictionary|array Array-like object … … 47 47 * Cookie flags 48 48 * 49 * Valid keys are (currently) creation, last-access, persistent and 50 * host-only. 49 * Valid keys are `'creation'`, `'last-access'`, `'persistent'` and `'host-only'`. 51 50 * 52 51 * @var array … … 67 66 * Create a new cookie object 68 67 * 69 * @param string $name70 * @param string $value68 * @param string $name The name of the cookie. 69 * @param string $value The value for the cookie. 71 70 * @param array|\WpOrg\Requests\Utility\CaseInsensitiveDictionary $attributes Associative array of attribute data 72 * @param array $flags 73 * @param int|null $reference_time 71 * @param array $flags The flags for the cookie. 72 * Valid keys are `'creation'`, `'last-access'`, 73 * `'persistent'` and `'host-only'`. 74 * @param int|null $reference_time Reference time for relative calculations. 74 75 * 75 76 * @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $name argument is not a string. … … 280 281 foreach ($this->attributes as $key => $value) { 281 282 $orig_value = $value; 282 $value = $this->normalize_attribute($key, $value); 283 284 if (is_string($key)) { 285 $value = $this->normalize_attribute($key, $value); 286 } 287 283 288 if ($value === null) { 284 289 unset($this->attributes[$key]); … … 300 305 * 301 306 * @param string $name Attribute name 302 * @param string| boolean $value Attribute value (stringvalue, or true if empty/flag)307 * @param string|int|bool $value Attribute value (string/integer value, or true if empty/flag) 303 308 * @return mixed Value if available, or null if the attribute value is invalid (and should be skipped) 304 309 */ -
trunk/src/wp-includes/Requests/src/Cookie/Jar.php
r54997 r55629 50 50 * Normalise cookie data into a \WpOrg\Requests\Cookie 51 51 * 52 * @param string|\WpOrg\Requests\Cookie $cookie 52 * @param string|\WpOrg\Requests\Cookie $cookie Cookie header value, possibly pre-parsed (object). 53 * @param string $key Optional. The name for this cookie. 53 54 * @return \WpOrg\Requests\Cookie 54 55 */ … … 107 108 * Unset the given header 108 109 * 109 * @param string $offset 110 * @param string $offset The key for the item to unset. 110 111 */ 111 112 #[ReturnTypeWillChange] … … 172 173 * Parse all cookies from a response and attach them to the response 173 174 * 174 * @param \WpOrg\Requests\Response $response 175 * @param \WpOrg\Requests\Response $response Response as received. 175 176 */ 176 177 public function before_redirect_check(Response $response) { -
trunk/src/wp-includes/Requests/src/IdnaEncoder.php
r54997 r55629 138 138 * @internal (Testing found regex was the fastest implementation) 139 139 * 140 * @param string $text 140 * @param string $text Text to examine. 141 141 * @return bool Is the text string ASCII-only? 142 142 */ … … 149 149 * 150 150 * @todo Implement this based on RFC 3491 and the newer 5891 151 * @param string $text 151 * @param string $text Text to prepare. 152 152 * @return string Prepared string 153 153 */ … … 161 161 * Based on \WpOrg\Requests\Iri::replace_invalid_with_pct_encoding() 162 162 * 163 * @param string $input 163 * @param string $input Text to convert. 164 164 * @return array Unicode code points 165 165 * … … 330 330 331 331 // output the code point for digit t + ((q - t) mod (base - t)) 332 $digit = $t + (($q - $t) % (self::BOOTSTRAP_BASE - $t));332 $digit = (int) ($t + (($q - $t) % (self::BOOTSTRAP_BASE - $t))); 333 333 $output .= self::digit_to_char($digit); 334 334 // let q = (q - t) div (base - t) 335 $q = floor(($q - $t) / (self::BOOTSTRAP_BASE - $t));335 $q = (int) floor(($q - $t) / (self::BOOTSTRAP_BASE - $t)); 336 336 } // end 337 337 // output the code point for digit q … … 382 382 * @param int $numpoints 383 383 * @param bool $firsttime 384 * @return int New bias384 * @return int|float New bias 385 385 * 386 386 * function adapt(delta,numpoints,firsttime): -
trunk/src/wp-includes/Requests/src/Iri.php
r54997 r55629 396 396 elseif (strpos($input, '/../') === 0) { 397 397 $input = substr($input, 3); 398 $output = substr_replace($output, '', strrpos($output, '/'));398 $output = substr_replace($output, '', (strrpos($output, '/') ?: 0)); 399 399 } 400 400 elseif ($input === '/..') { 401 401 $input = '/'; 402 $output = substr_replace($output, '', strrpos($output, '/'));402 $output = substr_replace($output, '', (strrpos($output, '/') ?: 0)); 403 403 } 404 404 // D: if the input buffer consists only of "." or "..", then remove … … 825 825 $iuserinfo = null; 826 826 } 827 if (($port_start = strpos($remaining, ':', strpos($remaining, ']'))) !== false) { 827 828 if (($port_start = strpos($remaining, ':', (strpos($remaining, ']') ?: 0))) !== false) { 828 829 $port = substr($remaining, $port_start + 1); 829 830 if ($port === false || $port === '') { -
trunk/src/wp-includes/Requests/src/Requests.php
r54997 r55629 149 149 * @var string 150 150 */ 151 const VERSION = '2.0. 5';151 const VERSION = '2.0.6'; 152 152 153 153 /** … … 643 643 * Set the default values 644 644 * 645 * The $options parameter is updated with the results. 646 * 645 647 * @param string $url URL to request 646 648 * @param array $headers Extra headers to send with the request … … 648 650 * @param string $type HTTP request type 649 651 * @param array $options Options for the request 650 * @return void $options is updated with the results652 * @return void 651 653 * 652 654 * @throws \WpOrg\Requests\Exception When the $url is not an http(s) URL. … … 825 827 * while still executing a multiple request. 826 828 * 829 * `$response` is either set to a \WpOrg\Requests\Response instance, or a \WpOrg\Requests\Exception object 830 * 827 831 * @param string $response Full response text including headers and body (will be overwritten with Response instance) 828 832 * @param array $request Request data as passed into {@see \WpOrg\Requests\Requests::request_multiple()} 829 * @return void `$response` is either set to a \WpOrg\Requests\Response instance, or a \WpOrg\Requests\Exception object833 * @return void 830 834 */ 831 835 public static function parse_multiple(&$response, $request) { -
trunk/src/wp-includes/Requests/src/Response.php
r54997 r55629 138 138 * @link https://php.net/json-decode 139 139 * 140 * @param ?bool $associative Optional. When `true`, JSON objects will be returned as associative arrays;141 * When `false`, JSON objects will be returned as objects.142 * When `null`, JSON objects will be returned as associative arrays143 * or objects depending on whether `JSON_OBJECT_AS_ARRAY` is set in the flags.144 * Defaults to `true` (in contrast to the PHP native default of `null`).145 * @param int $depth Optional. Maximum nesting depth of the structure being decoded.146 * Defaults to `512`.147 * @param int $options Optional. Bitmask of JSON_BIGINT_AS_STRING, JSON_INVALID_UTF8_IGNORE,148 * JSON_INVALID_UTF8_SUBSTITUTE, JSON_OBJECT_AS_ARRAY, JSON_THROW_ON_ERROR.149 * Defaults to `0` (no options set).140 * @param bool|null $associative Optional. When `true`, JSON objects will be returned as associative arrays; 141 * When `false`, JSON objects will be returned as objects. 142 * When `null`, JSON objects will be returned as associative arrays 143 * or objects depending on whether `JSON_OBJECT_AS_ARRAY` is set in the flags. 144 * Defaults to `true` (in contrast to the PHP native default of `null`). 145 * @param int $depth Optional. Maximum nesting depth of the structure being decoded. 146 * Defaults to `512`. 147 * @param int $options Optional. Bitmask of JSON_BIGINT_AS_STRING, JSON_INVALID_UTF8_IGNORE, 148 * JSON_INVALID_UTF8_SUBSTITUTE, JSON_OBJECT_AS_ARRAY, JSON_THROW_ON_ERROR. 149 * Defaults to `0` (no options set). 150 150 * 151 151 * @return array -
trunk/src/wp-includes/Requests/src/Response/Headers.php
r54997 r55629 28 28 * Set-Cookie headers. 29 29 * 30 * @param string $offset 30 * @param string $offset Name of the header to retrieve. 31 31 * @return string|null Header value 32 32 */ … … 70 70 * Get all values for a given header 71 71 * 72 * @param string $offset 72 * @param string $offset Name of the header to retrieve. 73 73 * @return array|null Header values 74 74 * … … 80 80 } 81 81 82 $offset = strtolower($offset); 82 if (is_string($offset)) { 83 $offset = strtolower($offset); 84 } 85 83 86 if (!isset($this->data[$offset])) { 84 87 return null; -
trunk/src/wp-includes/Requests/src/Transport/Curl.php
r54997 r55629 466 466 * @param array $options Request options 467 467 * @return string|false HTTP response data including headers. False if non-blocking. 468 * @throws \WpOrg\Requests\Exception 468 * @throws \WpOrg\Requests\Exception If the request resulted in a cURL error. 469 469 */ 470 470 public function process_response($response, $options) { … … 562 562 * Format a URL given GET data 563 563 * 564 * @param string $url564 * @param string $url Original URL. 565 565 * @param array|object $data Data to build query using, see {@link https://www.php.net/http_build_query} 566 566 * @return string URL with data -
trunk/src/wp-includes/Requests/src/Transport/Fsockopen.php
r54997 r55629 52 52 private $max_bytes = false; 53 53 54 /** 55 * Cache for received connection errors. 56 * 57 * @var string 58 */ 54 59 private $connect_error = ''; 55 60 … … 406 411 * Format a URL given GET data 407 412 * 408 * @param array $url_parts413 * @param array $url_parts Array of URL parts as received from {@link https://www.php.net/parse_url} 409 414 * @param array|object $data Data to build query using, see {@link https://www.php.net/http_build_query} 410 415 * @return string URL with data -
trunk/src/wp-includes/Requests/src/Utility/CaseInsensitiveDictionary.php
r54997 r55629 96 96 * Unset the given header 97 97 * 98 * @param string $offset 98 * @param string $offset The key for the item to unset. 99 99 */ 100 100 #[ReturnTypeWillChange] -
trunk/src/wp-includes/Requests/src/Utility/FilteredIterator.php
r54997 r55629 29 29 * Create a new iterator 30 30 * 31 * @param array $data31 * @param array $data The array or object to be iterated on. 32 32 * @param callable $callback Callback to be called on each value 33 33 * … … 47 47 48 48 /** 49 * @inheritdoc49 * Prevent unserialization of the object for security reasons. 50 50 * 51 51 * @phpcs:disable PHPCompatibility.FunctionNameRestrictions.NewMagicMethods.__unserializeFound 52 * 53 * @param array $data Restored array of data originally serialized. 54 * 55 * @return void 52 56 */ 53 57 #[ReturnTypeWillChange] … … 55 59 // phpcs:enable 56 60 61 /** 62 * Perform reinitialization tasks. 63 * 64 * Prevents a callback from being injected during unserialization of an object. 65 * 66 * @return void 67 */ 57 68 public function __wakeup() { 58 69 unset($this->callback); … … 76 87 77 88 /** 78 * @inheritdoc 89 * Prevent creating a PHP value from a stored representation of the object for security reasons. 90 * 91 * @param string $data The serialized string. 92 * 93 * @return void 79 94 */ 80 95 #[ReturnTypeWillChange] -
trunk/src/wp-includes/class-requests.php
r54997 r55629 20 20 // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error 21 21 trigger_error( 22 'The PSR-0 `Requests_...` class names in the Request library are deprecated.'22 'The PSR-0 `Requests_...` class names in the Requests library are deprecated.' 23 23 . ' Switch to the PSR-4 `WpOrg\Requests\...` class names at your earliest convenience.', 24 24 E_USER_DEPRECATED -
trunk/tests/phpunit/tests/http/includeOldRequestsClass.php
r55007 r55629 16 16 public function test_should_include_old_requests_class() { 17 17 $this->expectDeprecation(); 18 $this->expectDeprecationMessage( 'The PSR-0 `Requests_...` class names in the Request library are deprecated.' );18 $this->expectDeprecationMessage( 'The PSR-0 `Requests_...` class names in the Requests library are deprecated.' ); 19 19 20 20 new Requests();
Note: See TracChangeset
for help on using the changeset viewer.