Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/wp-includes/Requests/src/IdnaEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,18 +216,18 @@ protected static function utf8_to_codepoints($input) {
}

if (// Non-shortest form sequences are invalid
$length > 1 && $character <= 0x7F
|| $length > 2 && $character <= 0x7FF
|| $length > 3 && $character <= 0xFFFF
($length > 1 && $character <= 0x7F)
|| ($length > 2 && $character <= 0x7FF)
|| ($length > 3 && $character <= 0xFFFF)
// Outside of range of ucschar codepoints
// Noncharacters
|| ($character & 0xFFFE) === 0xFFFE
|| $character >= 0xFDD0 && $character <= 0xFDEF
|| ($character >= 0xFDD0 && $character <= 0xFDEF)
|| (
// Everything else not in ucschar
$character > 0xD7FF && $character < 0xF900
($character > 0xD7FF && $character < 0xF900)
|| $character < 0x20
|| $character > 0x7E && $character < 0xA0
|| ($character > 0x7E && $character < 0xA0)
|| $character > 0xEFFFD
)
) {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/Requests/src/Ipv6.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public static function check_ipv6($ip) {
list($ipv6, $ipv4) = self::split_v6_v4($ip);
$ipv6 = explode(':', $ipv6);
$ipv4 = explode('.', $ipv4);
if (count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4) {
if ((count($ipv6) === 8 && count($ipv4) === 1) || (count($ipv6) === 6 && count($ipv4) === 4)) {
foreach ($ipv6 as $ipv6_part) {
// The section can't be empty
if ($ipv6_part === '') {
Expand Down
38 changes: 20 additions & 18 deletions src/wp-includes/Requests/src/Iri.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public function __get($name) {
$return = null;
}

if ($return === null && isset($this->normalization[$this->scheme][$name])) {
if ($return === null && isset($this->scheme, $this->normalization[$this->scheme][$name])) {
return $this->normalization[$this->scheme][$name];
}
else {
Expand Down Expand Up @@ -669,27 +669,29 @@ protected function remove_iunreserved_percent_encoded($regex_match) {
}

protected function scheme_normalization() {
if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo']) {
$this->iuserinfo = null;
}
if (isset($this->normalization[$this->scheme]['ihost']) && $this->ihost === $this->normalization[$this->scheme]['ihost']) {
$this->ihost = null;
}
if (isset($this->normalization[$this->scheme]['port']) && $this->port === $this->normalization[$this->scheme]['port']) {
$this->port = null;
}
if (isset($this->normalization[$this->scheme]['ipath']) && $this->ipath === $this->normalization[$this->scheme]['ipath']) {
$this->ipath = '';
if (isset($this->scheme, $this->normalization[$this->scheme])) {
if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo']) {
$this->iuserinfo = null;
}
if (isset($this->normalization[$this->scheme]['ihost']) && $this->ihost === $this->normalization[$this->scheme]['ihost']) {
$this->ihost = null;
}
if (isset($this->normalization[$this->scheme]['port']) && $this->port === $this->normalization[$this->scheme]['port']) {
$this->port = null;
}
if (isset($this->normalization[$this->scheme]['ipath']) && $this->ipath === $this->normalization[$this->scheme]['ipath']) {
$this->ipath = '';
}
if (isset($this->normalization[$this->scheme]['iquery']) && $this->iquery === $this->normalization[$this->scheme]['iquery']) {
$this->iquery = null;
}
if (isset($this->normalization[$this->scheme]['ifragment']) && $this->ifragment === $this->normalization[$this->scheme]['ifragment']) {
$this->ifragment = null;
}
}
if (isset($this->ihost) && empty($this->ipath)) {
$this->ipath = '/';
}
if (isset($this->normalization[$this->scheme]['iquery']) && $this->iquery === $this->normalization[$this->scheme]['iquery']) {
$this->iquery = null;
}
if (isset($this->normalization[$this->scheme]['ifragment']) && $this->ifragment === $this->normalization[$this->scheme]['ifragment']) {
$this->ifragment = null;
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/Requests/src/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ class Requests {
*
* @var string
*/
const VERSION = '2.0.11';
const VERSION = '2.0.17';

/**
* Selected transport name
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/Requests/src/Response/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function offsetGet($offset) {
$offset = strtolower($offset);
}

if (!isset($this->data[$offset])) {
if (!isset($offset, $this->data[$offset])) {
return null;
}

Expand Down
6 changes: 5 additions & 1 deletion src/wp-includes/Requests/src/Transport/Curl.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public function __construct() {
*/
public function __destruct() {
if (is_resource($this->handle)) {
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.curl_closeDeprecated,Generic.PHP.DeprecatedFunctions.Deprecated
curl_close($this->handle);
}
}
Expand Down Expand Up @@ -306,7 +307,10 @@ public function request_multiple($requests, $options) {
}

curl_multi_remove_handle($multihandle, $done['handle']);
curl_close($done['handle']);
if (is_resource($done['handle'])) {
// phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.curl_closeDeprecated,Generic.PHP.DeprecatedFunctions.Deprecated
curl_close($done['handle']);
}

if (!is_string($responses[$key])) {
$options['hooks']->dispatch('multiple.request.complete', [&$responses[$key], $key]);
Expand Down
2 changes: 2 additions & 0 deletions src/wp-includes/Requests/src/Transport/Fsockopen.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ public function request($url, $headers = [], $data = [], $options = []) {
// 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+.
// phpcs:ignore PHPCompatibility.FunctionUse.NewFunctions.stream_context_set_optionsFound
stream_context_set_options($context, ['ssl' => $context_options]);
} else {
// PHP < 8.3.
// phpcs:ignore PHPCompatibility.FunctionUse.OptionalToRequiredFunctionParameters
stream_context_set_option($context, ['ssl' => $context_options]);
}
} else {
Expand Down
12 changes: 12 additions & 0 deletions src/wp-includes/Requests/src/Utility/CaseInsensitiveDictionary.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ public function offsetExists($offset) {
$offset = strtolower($offset);
}

if ($offset === null) {
$offset = '';
}

return isset($this->data[$offset]);
}

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

if ($offset === null) {
$offset = '';
}

if (!isset($this->data[$offset])) {
return null;
}
Expand Down Expand Up @@ -103,6 +111,10 @@ public function offsetUnset($offset) {
$offset = strtolower($offset);
}

if ($offset === null) {
$offset = '';
}

unset($this->data[$offset]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/Requests/src/Utility/FilteredIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ final class FilteredIterator extends ArrayIterator {
/**
* Create a new iterator
*
* @param array $data The array or object to be iterated on.
* @param array $data The array to be iterated on.
* @param callable $callback Callback to be called on each value
*
* @throws \WpOrg\Requests\Exception\InvalidArgument When the passed $data argument is not iterable.
*/
public function __construct($data, $callback) {
if (InputValidator::is_iterable($data) === false) {
if (is_object($data) === true || InputValidator::is_iterable($data) === false) {
throw InvalidArgument::create(1, '$data', 'iterable', gettype($data));
}

Expand Down
Loading