WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#7458 closed defect (bug) (fixed)

curl_setopt() throws errors in safe mode

Reported by: Po0ky Owned by:
Milestone: 2.7 Priority: normal
Severity: normal Version: 2.7
Component: General Keywords: curl safe_mode http has-patch tested commit
Focuses: Cc:

Description

I'm getting the following error on each page.

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /**/wordpress/wp-includes/http.php on line 843

My best guess is there should be a check before running the curl-setopt function to check if safe mode is set or not.

Attachments (2)

7458.diff (710 bytes) - added by ionfish 7 years ago.
fix_curl.patch (739 bytes) - added by Po0ky 7 years ago.
check_safe_curl.patch

Download all attachments as: .zip

Change History (12)

comment:1 @DD327 years ago

Of course theres no mention of this on the Curl page from what i can see..

Thats not the first curl_setopt() call either, My only guess is its supposed to prevent the script from entering a endless loop? (because without CURLOPT_MAXREDIRS set, it'll follow as many as it wants -- which is done on the next line)

Perhaps, It'd be best to just not use the curl class at all in safe mode? (Its the 2nd preference for GET requests at present, not used for post?)

comment:2 @ionfish7 years ago

Could just set CURLOPT_FOLLOWLOCATION only if safe mode isn't on.

@ionfish7 years ago

comment:3 @jacobsantos7 years ago

I need to turn on safe mode every once and a while while I run code probably.

@Po0ky7 years ago

check_safe_curl.patch

comment:4 @Po0ky7 years ago

Hmpf, ignore my patch. I must be stupid or blind. :/

comment:5 @santosj7 years ago

have you checked whether have it after the Max_redirs prevents the error?

comment:6 @santosj7 years ago

I checked and this should go in.

comment:7 @santosj7 years ago

  • Keywords has-patch tested commit added

comment:8 @santosj7 years ago

One question, what does open_basedir have to do with whether FOLLOWLOCATION can be used? just because open_basedir is set doesn't mean safe_mode is also.

comment:9 @ryan7 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [8534]) Don't call curl_setopt() if safe_mode is enabled. Props ionfish and Po0ky. fixes #7458 see #4779

comment:10 @santosj7 years ago

Oh right. The warning. That sucks.

Note: See TracTickets for help on using tickets.