laravel-mailchimp icon indicating copy to clipboard operation
laravel-mailchimp copied to clipboard

CURLOPT_FOLLOWLOCATION & open_basedir

Open Francois-Francois opened this issue 11 years ago • 14 comments

Using < PHP5.4 and with open_basedir set I get the following error:

curl_setopt(): CURLOPT_FOLLOWLOCATION cannot be activated when an open_basedir is set

This is a Mailchimp library issue, but i would be happy to know how laravel-mailchimp users get around this issue. For now, I've commented the bad line in mailchimp lib, but it's a quick fix.

On < PHP5.4, there is no safe_mode so you can't fill in this condition :

if ((PG(open_basedir) && *PG(open_basedir)) || PG(safe_mode)) {
  if (Z_LVAL_PP(zvalue) != 0) {
    php_error_docref(NULL TSRMLS_CC, E_WARNING, "CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set");
    RETVAL_FALSE;
    return 1;
  }
}

Francois-Francois avatar Feb 11 '14 20:02 Francois-Francois

Hi @rikless

To be honest I haven't encountered this issue myself and so have no sure fire way to cope with it. This package could do with a little TLC though - so I'll try and make time to do a little work on the weekend, and see if I can't document a work around.

Apologies if that wasn't what you were hoping for :(

hugofirth avatar Feb 11 '14 21:02 hugofirth

Hey, I have the same problem on PHP 5.4.10, just wondering if there is a workaround of any sort?

wagmiwiz avatar Jun 11 '14 16:06 wagmiwiz

Seems like using 2.0.4 mailchimp package instead fixes it. Add this to your composer.json: "mailchimp/mailchimp": "2.0.4",

kyrpas avatar Jun 12 '14 10:06 kyrpas

Hi @nikbora & @kyrpas

I see that the latest tagged release of the mailchimp/mailchimp package is 2.0.5. If reverting back solves your issue then by all means do it for now, but obviously this isn't ideal. If there really is a regression (2.0.5 re-introduced a bug which 2.0.4 fixed) then if you report the bug to mailchimp hopefully it will get fixed fairly promptly.

Cheers

hugofirth avatar Jun 12 '14 10:06 hugofirth

That is right, mailchimp 2.0.5 seems to break in a different way as it expects the $opts which initialise Mailchimp class to contain a flag for "CURLOPT_FOLLOWLOCATION". Seems a little strange they didn't decide to default to some value if not present - will check with them.

It causes an 'ErrorException' with message 'Undefined index: CURLOPT_FOLLOWLOCATION'

On Thu, Jun 12, 2014 at 11:05 AM, Hugo Firth [email protected] wrote:

Hi @nikbora https://github.com/nikbora & @kyrpas https://github.com/kyrpas

I see that the latest tagged release of the mailchimp/mailchimp package is 2.0.5. If reverting back solves your issue then by all means do it for now, but obviously this isn't ideal. If there really is a regression (2.0.5 re-introduced a bug which 2.0.4 fixed) then if you report the bug to mailchimp hopefully it will get fixed fairly promptly.

Cheers

— Reply to this email directly or view it on GitHub https://github.com/hugofirth/laravel-mailchimp/issues/10#issuecomment-45850760 .

wagmiwiz avatar Jun 12 '14 10:06 wagmiwiz

I have encountered the same issue.

"Undefined index: CURLOPT_FOLLOWLOCATION"

Will report to Mailchimp.

markovic131 avatar Jun 12 '14 11:06 markovic131

@psybaron do you fix this issue? i get that error too and i dont know the solution. anyone help me.

n3rotech avatar Jun 13 '14 02:06 n3rotech

You can put mailchimp/mailchimp 2.0.3 as an extra package in composer.json as a workaround. On 13 Jun 2014 03:26, "n3rotech" [email protected] wrote:

@psybaron https://github.com/psybaron do you fix this issue? i get that error too and i dont know the solution. anyone help me.

— Reply to this email directly or view it on GitHub https://github.com/hugofirth/laravel-mailchimp/issues/10#issuecomment-45969872 .

wagmiwiz avatar Jun 13 '14 03:06 wagmiwiz

thank you Brbora :D

On Thu, Jun 12, 2014 at 11:38 PM, Nik Brbora [email protected] wrote:

You can put mailchimp/mailchimp 2.0.3 as an extra package in composer.json as a workaround. On 13 Jun 2014 03:26, "n3rotech" [email protected] wrote:

@psybaron https://github.com/psybaron do you fix this issue? i get that error too and i dont know the solution. anyone help me.

— Reply to this email directly or view it on GitHub < https://github.com/hugofirth/laravel-mailchimp/issues/10#issuecomment-45969872>

.

— Reply to this email directly or view it on GitHub https://github.com/hugofirth/laravel-mailchimp/issues/10#issuecomment-45972902 .

n3rotech avatar Jun 13 '14 04:06 n3rotech

@nikbora how in your usage does 2.0.3 throw up any other bugs? I'm considering tagging a bug fix release with the hard dependency on that earlier version, and then tagging another release reverting back to the way it is now when Mailchimp tag a release which includes a bug fix for this issue.

hugofirth avatar Jun 18 '14 16:06 hugofirth

Hey Hugo, we have been running with mailchimp 2.0.3 with no issues or bugs.

On Wed, Jun 18, 2014 at 5:34 PM, Hugo Firth [email protected] wrote:

@nikbora https://github.com/nikbora how in your usage does 2.0.3 throw up any other bugs? I'm considering tagging a bug fix release with the hard dependency on that earlier version, and then tagging another release reverting back to the way it is now when Mailchimp tag a release which includes a bug fix for this issue.

— Reply to this email directly or view it on GitHub https://github.com/hugofirth/laravel-mailchimp/issues/10#issuecomment-46460084 .

wagmiwiz avatar Jun 18 '14 16:06 wagmiwiz

@hugofirth I switched this morning to 2.0.3, and no issue as well. Though I only use the API to add new registrants to a list.

markovic131 avatar Jun 18 '14 20:06 markovic131

@nikbora & @psybaron Ok - I'll give it till the morning for some testing and for others to chime in, and then tag a release then. I appreciate the input.

hugofirth avatar Jun 18 '14 21:06 hugofirth

In 2.0.4 this bug was present, and in 2.0.5, it's still there.

In 2.0.4, to get a functional application, I commented this line in : /vendor/mailchimp/mailchimp/src/Mailchimp.php

curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);

In 2.0.5, after a composer update, I had to comment in the same file :

if ($opts['CURLOPT_FOLLOWLOCATION'] === true) {
    curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
}

I've reported this issue since many times to mailchimp group, but even if code has change, issue isn't solved. https://groups.google.com/forum/#!topic/mailchimp-api-discuss/u5Xo30XF9Sw

Francois-Francois avatar Jun 20 '14 13:06 Francois-Francois