Make WordPress Core

#58091 closed defect (bug) (reported-upstream)

Requests library update to 2.0.0 breaks plugin

Reported by: gnif's profile gnif Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.2
Component: External Libraries Keywords:
Focuses: Cc:


As a hosting provider that provides tailored WordPress hosting for numerous clients we are often tasked with working around poorly written plugins and/or code that does not cache fetched results from external sources. As such we have developed a plugin that extends the Curl transport with a caching mechanism based on a whitelist of URLs.

As of the update to the 2.0.0 requests library, it is now impossible to do this anymore due to the use of the final keyword on the Curl class.

Here is how we were doing this.

  // register our transport wrapper

  // force our transport to load first
  Requests::$transport[serialize(['ssl' => true ])] = '\HF\Cache\cURL';
  Requests::$transport[serialize(['ssl' => false])] = '\HF\Cache\cURL';
  Requests::$transport[serialize([]              )] = '\HF\Cache\cURL';

Our class would then override the request method and either inherit the default functionality or respond with a cached value.

class cURL extends \Requests_Transport_cURL
  public function request($url, $headers = array(), $data = array(), $options = array())
    // custom caching logic here
    // inherit default logic
    return parent::request($url, $headers, $data, $options);

Instead we now get the fatal error:

Class HF\Cache\cURL may not inherit from final class (WpOrg\Requests\Transport\Curl)

Please remove the final attribute from the Curl class.

Change History (3)

#1 @costdev
14 months ago

  • Keywords reporter-feedback close added
  • Severity changed from critical to normal
  • Version changed from trunk to 6.2

Hi @gnif, thanks for opening this ticket.

This should be reported on the Requests GitHub Repository.

Please open a new issue and drop a link here so others can join the discussion and we can then close this ticket as reported-upstream. Until then, I'll tentatively add close for when the link has been posted.


#3 @costdev
14 months ago

  • Keywords reporter-feedback close removed
  • Milestone Awaiting Review deleted
  • Resolution set to reported-upstream
  • Status changed from new to closed

Thanks @gnif!

Note: See TracTickets for help on using tickets.