[wp-trac] [WordPress Trac] #57341: `Error: Class "Requests" not found` in trunk

WordPress Trac noreply at wordpress.org
Mon Dec 19 15:10:36 UTC 2022


#57341: `Error: Class "Requests" not found` in trunk
-------------------------------------------------+-------------------------
 Reporter:  bjorsch                              |       Owner:
                                                 |  hellofromTonya
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  6.2
Component:  HTTP API                             |     Version:  trunk
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  has-testing-info has-patch has-      |     Focuses:
  unit-tests commit                              |
-------------------------------------------------+-------------------------
Changes (by hellofromTonya):

 * status:  reviewing => closed
 * resolution:   => fixed


Comment:

 In [changeset:"55007" 55007]:
 {{{
 #!CommitTicketReference repository="" revision="55007"
 HTTP API: Adds BC-layer `/library/Requests.php` file.

 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.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/57341#comment:16>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list