Broken PHP Page when attempting to add a new email

Occasional Participant

Broken PHP Page when attempting to add a new email

Two weeks ago our ISP/Remote Hosting vendor updated our server environment with the following changes:

 

nss                  3.16.1  7.el6_5
nss-softokn          3.14.3  12.el6_5
nss-softokn-freebl   3.14.3  12.el6_5
nss-sysinit          3.16.1  7.el6_5
nss-tools            3.16.1  7.el6_5
nss-util             3.16.1  2.el6_5
php                  5.3.3   27.el6_5.2
php-cli              5.3.3   27.el6_5.2
php-common           5.3.3   27.el6_5.2
php-gd               5.3.3   27.el6_5.2
php-mbstring         5.3.3   27.el6_5.2
php-mysql            5.3.3   27.el6_5.2
php-pdo              5.3.3   27.el6_5.2
php-xml              5.3.3   27.el6_5.2
Immediately after, my Constant Contact email gathering process, that has been working for about a year now, broke. I will include code for that below. At first, I thought it might have been the incremental PHP upgrade, but rolling that back did not fix the problem.I also found an updated version of the OAUTH 2.0 SDK which I loaded to our server.... the last update was on 10-4 so I had hopes that something in that update might have been to address this issue. However -- still no fix.
We checked server logs immediately after submitting the broken page and saw these messages:
[Fri Oct 03 15:03:59 2014] [error] [client 71.39.98.131] PHP Catchable fatal error:  Argument 2 passed to Ctct\\Components\\ResultSet::__construct() must be an array, null given, called in /cust/idi/web/www/pub/candylandstore.com/OAuth2PHP/src/Ctct/Services/ContactService.php on line 35 and defined in /cust/idi/web/www/pub/candylandstore.com/OAuth2PHP/src/Ctct/Components/ResultSet.php on line 27, referer: http://candylandstore.com/php/checkout.php
 

[Fri Oct 03 15:03:59 2014] [error] [client 71.39.98.131] PHP Warning:  Invalid argument supplied for foreach() in /cust/idi/web/www/pub/candylandstore.com/OAuth2PHP/src/Ctct/Services/ContactService.php on line 32, referer: http://candylandstore.com/php/checkout.php
 
Oddly enough, when the page is submitted from a browser running from a Linux OS box, the page does not break. It only happens from a Windows or Mac computer browser session.
 
Here is the code I use to gather the email. It is triggered by the customer NOT opting out by checking a checkbox ('optoutbl')
 
/**** Add Email to Constant Contact if Customer opts in on Step 3 Billing Page ***********/
// attempt to fetch lists in the account, catching any exceptions and printing the errors to screen
try{    $lists = $cc->getLists(ACCESS_TOKEN);    }
catch (CtctException $ex)
    {
    foreach ($ex->getErrors() as $error)
        {        print_r($error);        }     
    }
// check if member opted in
 if (!isset($_POST['optoutbl']) )
    {  
    $action = "Getting Contact By Email Address";
    try
        {
        // check to see if a contact with the email addess already exists in the account
        $response = $cc->getContactByEmail(ACCESS_TOKEN, $email);
        // create a new contact if one does not exist
        if (empty($response->results))
            {
            $action = "Creating Contact";
            $contact = new Contact();
            $contact->addEmail($email);
            $contact->addList($lists[1]);
            $returnContact = $cc->addContact(ACCESS_TOKEN, $contact);
            }

        // update the existing contact if address already existed
          else
            {            
            $action = "Updating Contact";
            $contact = $response->results[0];
            $contact->addList($lists[1]);
            $returnContact = $cc->updateContact(ACCESS_TOKEN, $contact);  
            }
        } // end try
        
        // catch any exceptions thrown during the process and print the errors to screen
         catch (CtctException $ex)
        {
        echo '<span class="label label-important">Error '.$action.'</span>';
        echo '<div class="container alert-error"><pre class="failure-pre">';
        print_r($ex->getErrors());
        echo '</pre></div>';
        die();
        } //end catch Exceptions
    
     } // end if (isset($_POST['email']) && strlen($_POST['email']) > 1)  
    
    $_SESSION['emailaddchkout'] = "NO";
    if (isset($returnContact)) { $_SESSION['emailaddchkout'] = "YES"; }

/*****************************************************************************************/
I have tested the page using the opt-out check box and no error is generated -- which suggests to me that the issue is a result of some baisc incompatibility between our Server environment and the internals of the Constant Contact SDK. The softokn changes in the server could point to an issue with the token exchange -- but that is just a guess. I am currently by-passing the code -- but my customer needs to resume gathering emails and I need to ge them an answer on how I am going to accomplish this.
I am the developer on this project -- please copy any replies to [REDACTED]. Thanks
3 REPLIES 3
Member

 Hello,

 

I have replied to this post by email, as we will likely need some sensitive information to properly troubleshoot the issue.

 

Best Regards,

Elijah G.
API Support Engineer

We are running into the same problem.  Same error messages.  Constant Contact worked for us for sometime when we went live.  These are the changes made by our sys admin.  Do you have a solution to this?:

 

20151008 – Install mod_rewrite

  1. cd /etc/apache2/mods-enabled
  2. ln –s ../mods-available/rewrite.load

 

20151026 – Updated to use intermediate certificate at https://knowledge.rapidssl.com/support/ssl-certificate-support/index?page=content&actp=CROSSLINK&id=...

 

20151026 – Change apache security directives

  1. Edit /etc/apache2/conf-enabled/security.conf and change the following:
    ServerTokens Prod
    ServerSignature Off
  2. /etc/init.d/apache2 restart

 

20151028 – Added crypto stuff to apache

  1. Edit /etc/apache2/sites-available/www.indyplfoundation.org and add the following at the beginning:
    SSLEngine On
    SSLHonorCipherOrder on
    SSLCipherSuite {INFO --- if needed ask}


20160120 – Install php xsl module for Josh

  apt-get install php5-xsl

Hello,

 

While this previous post was from quite some time ago, my first suspicion is that your updated security settings have somehow caused the GlobalSign cehttps://api.constantcontact.com/ and reviewing the information there. It should be possible to dig a bit deeper into this from our side, but we will need some sensitive information to do so. Would you be able to contact us by email (webservices@constantcontact.com) with the following information?:

  • Constant Contact account name that is integrated with your website
  • Any detailed error messages that you may have
  • Last date/time that it was tested and failed
  • Last date/time that the integration was known to work

 

These details should allow us to get to the bottom of what's happening and get this resolved!

 

Sincerely,

Elijah G.
API Support Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page