loren138 / lk_cc

Constant Contact Plugin for ExpressionEngine
2 stars 2 forks source link

undefined offset 1, cc_class line 135 #5

Open LouWii opened 9 years ago

LouWii commented 9 years ago

Hi, In case anyone got this issue, I fixed it. As cc_class.php is provided by ConstantContact, I didn't make a pull request, but I can do it if needed.

The code fixed, line 132 in lk_cc\cc_class.php :

             if ((string) $tmp->rel == 'next') {
                    $nextUrl = (string) $tmp->href;
                    $arrTmp = explode($this->login, $nextUrl);
                    if (array_key_exists(1, $arrTmp))
                    {
                        $nextUrl = $arrTmp[1];
                        $call2 = $this->apiPath.$nextUrl;
                    }
                    else
                    {
                        $call2 = NULL;
                    }

                    break;
            }

Basically, we verify if the "next url" is present. If not, set $call2 to null so we know we got all lists from ConstantContact. I don't know if that's the proper way to fix it, but it works. And as API v1 is deprecated, I don't think ConstantContact team is caring about that.

loren138 commented 9 years ago

Hm, I wonder if this issue is the same idea as #3? If anyone else can confirm this works, I could merge a pull request on it so future people don't have it.