getkirby-v2 / toolkit

This is the deprecated toolkit for Kirby v2.

Home Page:http://getkirby.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CURLOPT_FOLLOWLOCATION may cause other curl options to be discarded

shimikano opened this issue · comments

Dear developers

Apparently, setting curl_setopt(..., CURLOPT_FOLLOWLOCATION) fails (i.e., returns FALSE) if the PHP setting open_basedir is set:

Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION 
cannot be activated when in safe_mode or an open_basedir is set in ...

I encountered open_basedir to be set on various shared web hosters.

As per the docs, curl_setopt_array(...) in remote.php only proceeds setting options until the first error is encountered. In other words, if setting CURLOPT_FOLLOWLOCATION fails, all subsequent options in the array are discarded.

In my case, this had the consequence of me being unable to send e-mails through Mailgun, since the crucial CURLOPT_POST option was not set.

While CURLOPT_FOLLOWLOCATION seems to make sense in general, one could argue that failing to set it shouldn't cause other options to be discarded.

A possible fix would be to inline the curl_setopt_array(...) call without the 'stop-on-first-error' logic.