Skip to content

Commit 33f013a

Browse files
External Libraries: Update the Requests library to version 2.0.17.
The most notable changes are PHP 8.5 compatibility fixes in version 2.0.16. Other releases between 2.0.11 and 2.0.17 contain only certificate bundle updates, which are skipped as WordPress manages its own certificate bundle (#62812). References: * [https://github.com/WordPress/Requests/releases/tag/v2.0.17 Requests 2.0.17 release notes] * [https://github.com/WordPress/Requests/releases/tag/v2.0.16 Requests 2.0.16 release notes] * [https://github.com/WordPress/Requests/releases/tag/v2.0.15 Requests 2.0.15 release notes] * [https://github.com/WordPress/Requests/releases/tag/v2.0.14 Requests 2.0.14 release notes] * [https://github.com/WordPress/Requests/releases/tag/v2.0.13 Requests 2.0.13 release notes] * [https://github.com/WordPress/Requests/releases/tag/v2.0.12 Requests 2.0.12 release notes] * [WordPress/Requests@v2.0.11...v2.0.17 Full list of changes from Requests 2.0.11 to 2.0.17] Follow-up to [54997], [55629], [56554], [56835], [57086], [57876]. Props rodrigosprimo, desrosj. Fixes #64752. git-svn-id: https://develop.svn.wordpress.org/trunk@61769 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 29d5f6e commit 33f013a

File tree

9 files changed

+50
-30
lines changed

9 files changed

+50
-30
lines changed

src/wp-includes/Requests/src/IdnaEncoder.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -216,18 +216,18 @@ protected static function utf8_to_codepoints($input) {
216216
}
217217

218218
if (// Non-shortest form sequences are invalid
219-
$length > 1 && $character <= 0x7F
220-
|| $length > 2 && $character <= 0x7FF
221-
|| $length > 3 && $character <= 0xFFFF
219+
($length > 1 && $character <= 0x7F)
220+
|| ($length > 2 && $character <= 0x7FF)
221+
|| ($length > 3 && $character <= 0xFFFF)
222222
// Outside of range of ucschar codepoints
223223
// Noncharacters
224224
|| ($character & 0xFFFE) === 0xFFFE
225-
|| $character >= 0xFDD0 && $character <= 0xFDEF
225+
|| ($character >= 0xFDD0 && $character <= 0xFDEF)
226226
|| (
227227
// Everything else not in ucschar
228-
$character > 0xD7FF && $character < 0xF900
228+
($character > 0xD7FF && $character < 0xF900)
229229
|| $character < 0x20
230-
|| $character > 0x7E && $character < 0xA0
230+
|| ($character > 0x7E && $character < 0xA0)
231231
|| $character > 0xEFFFD
232232
)
233233
) {

src/wp-includes/Requests/src/Ipv6.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public static function check_ipv6($ip) {
161161
list($ipv6, $ipv4) = self::split_v6_v4($ip);
162162
$ipv6 = explode(':', $ipv6);
163163
$ipv4 = explode('.', $ipv4);
164-
if (count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4) {
164+
if ((count($ipv6) === 8 && count($ipv4) === 1) || (count($ipv6) === 6 && count($ipv4) === 4)) {
165165
foreach ($ipv6 as $ipv6_part) {
166166
// The section can't be empty
167167
if ($ipv6_part === '') {

src/wp-includes/Requests/src/Iri.php

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function __get($name) {
214214
$return = null;
215215
}
216216

217-
if ($return === null && isset($this->normalization[$this->scheme][$name])) {
217+
if ($return === null && isset($this->scheme, $this->normalization[$this->scheme][$name])) {
218218
return $this->normalization[$this->scheme][$name];
219219
}
220220
else {
@@ -669,27 +669,29 @@ protected function remove_iunreserved_percent_encoded($regex_match) {
669669
}
670670

671671
protected function scheme_normalization() {
672-
if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo']) {
673-
$this->iuserinfo = null;
674-
}
675-
if (isset($this->normalization[$this->scheme]['ihost']) && $this->ihost === $this->normalization[$this->scheme]['ihost']) {
676-
$this->ihost = null;
677-
}
678-
if (isset($this->normalization[$this->scheme]['port']) && $this->port === $this->normalization[$this->scheme]['port']) {
679-
$this->port = null;
680-
}
681-
if (isset($this->normalization[$this->scheme]['ipath']) && $this->ipath === $this->normalization[$this->scheme]['ipath']) {
682-
$this->ipath = '';
672+
if (isset($this->scheme, $this->normalization[$this->scheme])) {
673+
if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo']) {
674+
$this->iuserinfo = null;
675+
}
676+
if (isset($this->normalization[$this->scheme]['ihost']) && $this->ihost === $this->normalization[$this->scheme]['ihost']) {
677+
$this->ihost = null;
678+
}
679+
if (isset($this->normalization[$this->scheme]['port']) && $this->port === $this->normalization[$this->scheme]['port']) {
680+
$this->port = null;
681+
}
682+
if (isset($this->normalization[$this->scheme]['ipath']) && $this->ipath === $this->normalization[$this->scheme]['ipath']) {
683+
$this->ipath = '';
684+
}
685+
if (isset($this->normalization[$this->scheme]['iquery']) && $this->iquery === $this->normalization[$this->scheme]['iquery']) {
686+
$this->iquery = null;
687+
}
688+
if (isset($this->normalization[$this->scheme]['ifragment']) && $this->ifragment === $this->normalization[$this->scheme]['ifragment']) {
689+
$this->ifragment = null;
690+
}
683691
}
684692
if (isset($this->ihost) && empty($this->ipath)) {
685693
$this->ipath = '/';
686694
}
687-
if (isset($this->normalization[$this->scheme]['iquery']) && $this->iquery === $this->normalization[$this->scheme]['iquery']) {
688-
$this->iquery = null;
689-
}
690-
if (isset($this->normalization[$this->scheme]['ifragment']) && $this->ifragment === $this->normalization[$this->scheme]['ifragment']) {
691-
$this->ifragment = null;
692-
}
693695
}
694696

695697
/**

src/wp-includes/Requests/src/Requests.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ class Requests {
148148
*
149149
* @var string
150150
*/
151-
const VERSION = '2.0.11';
151+
const VERSION = '2.0.17';
152152

153153
/**
154154
* Selected transport name

src/wp-includes/Requests/src/Response/Headers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function offsetGet($offset) {
3535
$offset = strtolower($offset);
3636
}
3737

38-
if (!isset($this->data[$offset])) {
38+
if (!isset($offset, $this->data[$offset])) {
3939
return null;
4040
}
4141

src/wp-includes/Requests/src/Transport/Curl.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ public function __construct() {
126126
*/
127127
public function __destruct() {
128128
if (is_resource($this->handle)) {
129+
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.curl_closeDeprecated,Generic.PHP.DeprecatedFunctions.Deprecated
129130
curl_close($this->handle);
130131
}
131132
}
@@ -306,7 +307,10 @@ public function request_multiple($requests, $options) {
306307
}
307308

308309
curl_multi_remove_handle($multihandle, $done['handle']);
309-
curl_close($done['handle']);
310+
if (is_resource($done['handle'])) {
311+
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.curl_closeDeprecated,Generic.PHP.DeprecatedFunctions.Deprecated
312+
curl_close($done['handle']);
313+
}
310314

311315
if (!is_string($responses[$key])) {
312316
$options['hooks']->dispatch('multiple.request.complete', [&$responses[$key], $key]);

src/wp-includes/Requests/src/Transport/Fsockopen.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,11 @@ public function request($url, $headers = [], $data = [], $options = []) {
148148
// Ref: https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures#stream_context_set_option
149149
if (function_exists('stream_context_set_options')) {
150150
// PHP 8.3+.
151+
// phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.stream_context_set_optionsFound
151152
stream_context_set_options($context, ['ssl' => $context_options]);
152153
} else {
153154
// PHP < 8.3.
155+
// phpcs:ignore PHPCompatibility.FunctionUse.OptionalToRequiredFunctionParameters
154156
stream_context_set_option($context, ['ssl' => $context_options]);
155157
}
156158
} else {

src/wp-includes/Requests/src/Utility/CaseInsensitiveDictionary.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ public function offsetExists($offset) {
4949
$offset = strtolower($offset);
5050
}
5151

52+
if ($offset === null) {
53+
$offset = '';
54+
}
55+
5256
return isset($this->data[$offset]);
5357
}
5458

@@ -64,6 +68,10 @@ public function offsetGet($offset) {
6468
$offset = strtolower($offset);
6569
}
6670

71+
if ($offset === null) {
72+
$offset = '';
73+
}
74+
6775
if (!isset($this->data[$offset])) {
6876
return null;
6977
}
@@ -103,6 +111,10 @@ public function offsetUnset($offset) {
103111
$offset = strtolower($offset);
104112
}
105113

114+
if ($offset === null) {
115+
$offset = '';
116+
}
117+
106118
unset($this->data[$offset]);
107119
}
108120

src/wp-includes/Requests/src/Utility/FilteredIterator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ final class FilteredIterator extends ArrayIterator {
2828
/**
2929
* Create a new iterator
3030
*
31-
* @param array $data The array or object to be iterated on.
31+
* @param array $data The array to be iterated on.
3232
* @param callable $callback Callback to be called on each value
3333
*
3434
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $data argument is not iterable.
3535
*/
3636
public function __construct($data, $callback) {
37-
if (InputValidator::is_iterable($data) === false) {
37+
if (is_object($data) === true || InputValidator::is_iterable($data) === false) {
3838
throw InvalidArgument::create(1, '$data', 'iterable', gettype($data));
3939
}
4040

0 commit comments

Comments
 (0)