WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#37747 closed defect (bug) (invalid)

Call to undefined method Requests_Response::is_redirect()

Reported by: lordspace Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: HTTP API Keywords:
Focuses: Cc:
PR Number:

Description

Has anybody experienced this issue that WP/php can't find Requests_Response's is_redirect method?

WP 4.6
PHP Version 5.5.9-1ubuntu4.19
php opcache turned off & apache conf reloaded
php as apache module

Change History (7)

#1 @Clorith
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Hiya,

We've discovered that this happens when a plugin or theme includes an older version of the Requests library, you'll have to disable your plugins to identify which one does this.

#2 @lordspace
3 years ago

Thanks @Clorith. Oh, ok. Makes sense.

#3 @ypeiffer
3 years ago

Hi,

this issue occurs even with the newest version of the Requests library (v1.6.1) and WordPress 4.6. The Requests library did work with WordPress 4.5.3 perfectly.

WP 4.6
PHP Version 5.6.10
php as apache module

#4 @noclique
3 years ago

Ran into the same issue. Not working with latest Requests library 1.6.1.

#5 @Clorith
3 years ago

The function is still found in core as expected.

Are you both by any chance including a version of Requests in your plugins, if so I'd highly recommend using the one now shipped with core to avoid any procedural weirdness (keep in mind it was introduced with 4.6, so any version prior to this wouldn't be able to have conflicting libraries).

#6 follow-up: @noclique
3 years ago

Hey @Clorith

I am using Requests in the plugin I'm developing. I like your idea of deferring to the version used within WordPress now that it's included within 4.6. However I'll need the plugin to work for versions before 4.6 as-well. I suppose I could place a conditional somewhere in the code and only load the version of Requests that comes with my plugin if it's not found within WordPress.

I guess the main question is whether the error is resolved if using the version of Requests included with WordPress, and also if the error persists if the WordPress version is < 4.6 while using the external version of Requests.

#7 in reply to: ↑ 6 @dd32
3 years ago

Replying to noclique:

Hey @Clorith

I am using Requests in the plugin I'm developing. I like your idea of deferring to the version used within WordPress now that it's included within 4.6. However I'll need the plugin to work for versions before 4.6 as-well. I suppose I could place a conditional somewhere in the code and only load the version of Requests that comes with my plugin if it's not found within WordPress.

If it's a plugin you're going to distribute, you should really use the wp_remote_*() functions instead of Requests directly.

Note: See TracTickets for help on using tickets.