Skip to content

Commit b97221d

Browse files
author
wordpress-develop-pr-bot[bot]
committed
Automation: Updating built files with changes.
1 parent 33ee116 commit b97221d

File tree

10 files changed

+75
-35
lines changed

10 files changed

+75
-35
lines changed
Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,78 @@
11
<?php
22
/**
3-
* Loads the old Requests class file when the autoloader
4-
* references the original PSR-0 Requests class.
3+
* Requests for PHP
54
*
6-
* @deprecated 6.2.0
7-
* @package WordPress
8-
* @subpackage Requests
9-
* @since 6.2.0
5+
* Inspired by Requests for Python.
6+
*
7+
* Based on concepts from SimplePie_File, RequestCore and WP_Http.
8+
*
9+
* @package Requests
10+
*
11+
* @deprecated 2.0.0
12+
*/
13+
14+
/*
15+
* Integrators who cannot yet upgrade to the PSR-4 class names can silence deprecations
16+
* by defining a `REQUESTS_SILENCE_PSR0_DEPRECATIONS` constant and setting it to `true`.
17+
* The constant needs to be defined before this class is required.
18+
*/
19+
if (!defined('REQUESTS_SILENCE_PSR0_DEPRECATIONS') || REQUESTS_SILENCE_PSR0_DEPRECATIONS !== true) {
20+
// phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error
21+
trigger_error(
22+
'The PSR-0 `Requests_...` class names in the Requests library are deprecated.'
23+
. ' Switch to the PSR-4 `WpOrg\Requests\...` class names at your earliest convenience.',
24+
E_USER_DEPRECATED
25+
);
26+
27+
// Prevent the deprecation notice from being thrown twice.
28+
if (!defined('REQUESTS_SILENCE_PSR0_DEPRECATIONS')) {
29+
define('REQUESTS_SILENCE_PSR0_DEPRECATIONS', true);
30+
}
31+
}
32+
33+
require_once dirname(__DIR__) . '/src/Requests.php';
34+
35+
/**
36+
* Requests for PHP
37+
*
38+
* Inspired by Requests for Python.
39+
*
40+
* Based on concepts from SimplePie_File, RequestCore and WP_Http.
41+
*
42+
* @package Requests
43+
*
44+
* @deprecated 2.0.0 Use `WpOrg\Requests\Requests` instead for the actual functionality and
45+
* use `WpOrg\Requests\Autoload` for the autoloading.
1046
*/
47+
class Requests extends WpOrg\Requests\Requests {
48+
49+
/**
50+
* Deprecated autoloader for Requests.
51+
*
52+
* @deprecated 2.0.0 Use the `WpOrg\Requests\Autoload::load()` method instead.
53+
*
54+
* @codeCoverageIgnore
55+
*
56+
* @param string $class Class name to load
57+
*/
58+
public static function autoloader($class) {
59+
if (class_exists('WpOrg\Requests\Autoload') === false) {
60+
require_once dirname(__DIR__) . '/src/Autoload.php';
61+
}
62+
63+
return WpOrg\Requests\Autoload::load($class);
64+
}
1165

12-
include_once ABSPATH . WPINC . '/class-requests.php';
66+
/**
67+
* Register the built-in autoloader
68+
*
69+
* @deprecated 2.0.0 Include the `WpOrg\Requests\Autoload` class and
70+
* call `WpOrg\Requests\Autoload::register()` instead.
71+
*
72+
* @codeCoverageIgnore
73+
*/
74+
public static function register_autoloader() {
75+
require_once dirname(__DIR__) . '/src/Autoload.php';
76+
WpOrg\Requests\Autoload::register();
77+
}
78+
}

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,4 @@ public function dispatch($hook, $parameters = []) {
9696

9797
return true;
9898
}
99-
100-
public function __wakeup() {
101-
throw new \LogicException( __CLASS__ . ' should never be unserialized' );
102-
}
10399
}

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -717,20 +717,6 @@ public function is_valid() {
717717
return true;
718718
}
719719

720-
public function __wakeup() {
721-
$class_props = get_class_vars( __CLASS__ );
722-
$string_props = array( 'scheme', 'iuserinfo', 'ihost', 'port', 'ipath', 'iquery', 'ifragment' );
723-
$array_props = array( 'normalization' );
724-
foreach ( $class_props as $prop => $default_value ) {
725-
if ( in_array( $prop, $string_props, true ) && ! is_string( $this->$prop ) ) {
726-
throw new UnexpectedValueException();
727-
} elseif ( in_array( $prop, $array_props, true ) && ! is_array( $this->$prop ) ) {
728-
throw new UnexpectedValueException();
729-
}
730-
$this->$prop = null;
731-
}
732-
}
733-
734720
/**
735721
* Set the entire IRI. Returns true on success, false on failure (if there
736722
* are any invalid characters).

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,6 @@ public function request_multiple($requests, $options = []) {
265265
return Requests::request_multiple($requests, $options);
266266
}
267267

268-
public function __wakeup() {
269-
throw new \LogicException( __CLASS__ . ' should never be unserialized' );
270-
}
271-
272268
/**
273269
* Merge a request's data with the default data
274270
*

src/wp-includes/SimplePie/library/SimplePie.php

100644100755
File mode changed.

src/wp-includes/SimplePie/library/SimplePie/Cache/Memcached.php

100644100755
File mode changed.

src/wp-includes/SimplePie/library/SimplePie/Registry.php

100644100755
File mode changed.

src/wp-includes/SimplePie/src/Cache/Memcached.php

100755100644
File mode changed.

src/wp-includes/SimplePie/src/IRI.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public function __get(string $name)
170170
$return = null;
171171
}
172172

173-
if ($return === null && isset($this->scheme, $this->normalization[$this->scheme][$name])) {
173+
if ($return === null && isset($this->normalization[$this->scheme][$name])) {
174174
return $this->normalization[$this->scheme][$name];
175175
}
176176

@@ -623,10 +623,6 @@ protected function remove_iunreserved_percent_encoded(array $match)
623623
*/
624624
protected function scheme_normalization()
625625
{
626-
if ($this->scheme === null) {
627-
return;
628-
}
629-
630626
if (isset($this->normalization[$this->scheme]['iuserinfo']) && $this->iuserinfo === $this->normalization[$this->scheme]['iuserinfo']) {
631627
$this->iuserinfo = null;
632628
}

src/wp-includes/SimplePie/src/SimplePie.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3306,7 +3306,7 @@ public function __call(string $method, array $args)
33063306
}
33073307

33083308
$class = get_class($this);
3309-
$trace = debug_backtrace(); // phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
3309+
$trace = debug_backtrace();
33103310
$file = $trace[0]['file'] ?? '';
33113311
$line = $trace[0]['line'] ?? '';
33123312
throw new SimplePieException("Call to undefined method $class::$method() in $file on line $line");

0 commit comments

Comments
 (0)