mirror of
git://develop.git.wordpress.org/
synced 2025-02-06 23:50:43 +01:00
HTTP API: Adds BC-layer /library/Requests.php
file.
When the Requests 2.0.0 [7ef0774f0b/src/Autoload.php (L141-L143)
autoloader detects the older (deprecated) `Requests` class], it attempts to load [https://github.com/WordPress/Requests/blob/v2.0.0/library/Requests.php its `/library/Requests.php` file]. Prior to this commit, this file did not exist in Core. Thus, a fatal error happened.
Why not change Requests Autoloader?
Requests is an external dependency that Core consumes. It is also used by other projects outside of Core. Thus, Core needs a fix to guard itself to prevent a fatal error.
The fix:
* Adds the missing `wp-includes/Requests/library/Requests.php` file, which then loads the `wp-includes/class-requests.php` (which will throw a deprecation notice to alert developers to upgrade).
* Adds a test.
Follow-up to [54997].
Props bjorsch, costdev, jrf, mukesh27, peterwilsoncc, ironprogrammer, hellofromTonya.
Fixes #57341.
git-svn-id: https://develop.svn.wordpress.org/trunk@55007 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
dd9fa21839
commit
429829d6d9
12
src/wp-includes/Requests/library/Requests.php
Normal file
12
src/wp-includes/Requests/library/Requests.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
/**
|
||||
* Loads the old Requests class file when the autoloader
|
||||
* references the original PSR-0 Requests class.
|
||||
*
|
||||
* @deprecated 6.2.0
|
||||
* @package WordPress
|
||||
* @subpackage Requests
|
||||
* @since 6.2.0
|
||||
*/
|
||||
|
||||
include_once ABSPATH . WPINC . '/class-requests.php';
|
22
tests/phpunit/tests/http/includeOldRequestsClass.php
Normal file
22
tests/phpunit/tests/http/includeOldRequestsClass.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Tests that the old Requests class is included
|
||||
* for plugins or themes that still use it.
|
||||
*
|
||||
* @group http
|
||||
*/
|
||||
class Tests_HTTP_IncludeOldRequestsClass extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 57341
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
public function test_should_include_old_requests_class() {
|
||||
$this->expectDeprecation();
|
||||
$this->expectDeprecationMessage( 'The PSR-0 `Requests_...` class names in the Request library are deprecated.' );
|
||||
|
||||
new Requests();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user