I'm using PHP class from https://github.com/constantcontact/Constant-Contact-PHP-Sample-Contact-Forms to add new contacts to Constant Contact list, but recently I have got PHP error messages:
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 1
Filename: cc_class.php
Line Number: 248
A PHP Error was encountered
Severity: Notice
Message: Undefined offset: 1
Filename: cc_class.php
Line Number: 252
where those lines look like:
(248)
$xml = simplexml_load_string($return);
(252)
}
and full related function to those two lines:
public function subscriberExists($email = '') {
$call = $this->apiPath.'/contacts?email='.$email;
$return = $this->doServerCall($call);
$xml = simplexml_load_string($return);
$id = $xml->entry->id;
if($id){ return $id; }
else { return false; }
}
but it passes data to Constan Contact anyway.
Any clue what is going on there with those error messages?
Thanks
From the class GitHub
This is just a PHP notice, not a failure, when trying to access an index of an array that hasn't been defined yet. The codebase in this app is fairly old, and hasn't been brought up to date as PHP is upgraded.
We would recommend instead of using this repo, utilizing the newer PHP SDK which is object-oriented, available via composer, and kept up to date. You can definitely mute these notifications in your environment, but this repo is deprecated, so this issue won't be addressed in the project.