Skip to content

Commit

Permalink
HTTP API: Adds BC-layer /library/Requests.php file.
Browse files Browse the repository at this point in the history
When the Requests 2.0.0 [https://github.com/WordPress/Requests/blob/7ef0774f0bf32dddb7b6c1dd01e4d285c2ba3c3f/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.
Built from https://develop.svn.wordpress.org/trunk@55007


git-svn-id: http://core.svn.wordpress.org/trunk@54540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
hellofromtonya committed Dec 19, 2022
1 parent a65e377 commit eff9f72
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 12 additions & 0 deletions wp-includes/Requests/library/Requests.php
Original file line number Diff line number Diff line change
@@ -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';
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-55006';
$wp_version = '6.2-alpha-55007';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit eff9f72

Please sign in to comment.