CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Undefined index: contact_id in /civicrm/api/v3/Contact.php on line 587
Pages: [1]

Author Topic: Undefined index: contact_id in /civicrm/api/v3/Contact.php on line 587  (Read 1032 times)

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
Undefined index: contact_id in /civicrm/api/v3/Contact.php on line 587
July 26, 2011, 08:41:06 am
Using the API to import contacts. I had no problem on my test installation, but now on my VPS, I get the following repsonse in my shell terminal.

Code: [Select]
Undefined index:  contact_id in /civicrm/api/v3/Contact.php on line 587
 Undefined index:  contact_id in /civicrm/api/v3/Contact.php on line 587
 Undefined index:  contact_id in /civicrm/api/v3/Contact.php on line 587

I get it 3 times like that every time the script runs past my:
Code: [Select]
$results=civicrm_api("Contact","create" ,$contactParams);
It still seems to be adding the contacts to my db - but I just don't like error messages!!

Any ideas? Line 587 in contact.php is:
Code: [Select]
$customValue = $params['contact_id'] ? CRM_Core_DAO::getFieldValue( 'CRM_Contact_DAO_Contact',
                                                                            $params['contact_id'],
                                                                            "{$key}{$greeting}_custom" ) : false;

Brian

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Undefined index: contact_id in /civicrm/api/v3/Contact.php on line 587
July 26, 2011, 12:40:05 pm
Hi, You can log an issue on this one but it's a coding standard issue not an error as such. You can ignore it or google how to reduces your 'error_reporting' level to exclude E-Notice
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Undefined index: contact_id in /civicrm/api/v3/Contact.php on line 587
July 26, 2011, 01:19:43 pm
NB - If you want to try patching it & submit a patch too you'd be looking at replacing

$customValue = $params['contact_id'] 

with something like


$customValue = CRM_Utils_Array::value('contact_id',$params) ? CRM_Core_DAO::getFieldValue( 'CRM_Contact_DAO_Contact',
                                                                            $params['contact_id'],
                                                                            "{$key}{$greeting}_custom" ) : false;


 CRM_Utils_Array::value  is a Civi function that checks a value is set & then returns it. It's the initial check which avoids the E-Notice

Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

bpmccain

  • I post frequently
  • ***
  • Posts: 255
  • Karma: 5
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.12
  • MySQL version: 5.2
  • PHP version: 5.2
Re: Undefined index: contact_id in /civicrm/api/v3/Contact.php on line 587
July 28, 2011, 11:47:41 am
Thanks Eileen. I'll look into it.

Brian

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Undefined index: contact_id in /civicrm/api/v3/Contact.php on line 587

This forum was archived on 2017-11-26.