hugofirth / laravel-mailchimp

A composer package for the MailChimp API PHP class (as provided by MailChimp) which supports the Laravel 4 framework.
96 stars 27 forks source link

CURLOPT_FOLLOWLOCATION & open_basedir #10

Open Francois-Francois opened 10 years ago

Francois-Francois commented 10 years ago

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;
  }
}
hugofirth commented 10 years ago

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 :(

wagmiwiz commented 10 years ago

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

kyrpas commented 10 years ago

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

hugofirth commented 10 years ago

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

wagmiwiz commented 10 years ago

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 notifications@github.com 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 .

markovic131 commented 10 years ago

I have encountered the same issue.

"Undefined index: CURLOPT_FOLLOWLOCATION"

Will report to Mailchimp.

n3rotech commented 10 years ago

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

wagmiwiz commented 10 years ago

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" notifications@github.com 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 .

n3rotech commented 10 years ago

thank you Brbora :D

On Thu, Jun 12, 2014 at 11:38 PM, Nik Brbora notifications@github.com 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" notifications@github.com 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 .

hugofirth commented 10 years ago

@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.

wagmiwiz commented 10 years ago

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 notifications@github.com 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 .

markovic131 commented 10 years ago

@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.

hugofirth commented 10 years ago

@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.

Francois-Francois commented 10 years ago

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