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) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Undefined variable: imProvider in CRM_Core_BAO_Mapping
Pages: [1]

Author Topic: Undefined variable: imProvider in CRM_Core_BAO_Mapping  (Read 1327 times)

ehowland

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6
  • MySQL version: various
  • PHP version: various
Undefined variable: imProvider in CRM_Core_BAO_Mapping
September 12, 2011, 06:45:17 am
I am running  CiviCRM 4.0.5 with:

   Drupal   7.7  OK
   Database system   MySQL, MariaDB, or equivalent OK
   Database system version   5.1.37 OK
   PHP   5.2.11 (more information) OK
   PHP extensions   Enabled OK
   PHP memory limit   256M OK
   
When I try to export a mapping that was defined several generations ago.  I get this message many times:

Notice: Undefined variable: imProvider in CRM_Core_BAO_Mapping::buildMappingForm() (line 746 of sites/all/modules/civicrm/CRM/Core/BAO/Mapping.php).

This same error is also reported in http://forum.civicrm.org/index.php?topic=20437.0.  I can not reproduce it on the demo site by creating a new mapping and then reusing it. But perhaps that scenario does not exercise this branch of the if statement. 

I am wondering if this might be a true bug.  It is in a nested if statement and perhaps that path is not commonly triggered.  I only partially understand the code in Mapping.php but it seems that imProvider really is not initialized.

Programming by analogy suggests the following patch which may not be logically correct, but since it forces a value for imProvider it does remove the error.  Perhaps the question is if mappingIMProvider is analogous to mappingPhoneType.

diff --git a/mmm-civi/sites/all/modules/civicrm/CRM/Core/BAO/Mapping.php b/mmm-c
index 45cdfd2..e205ed8 100644
--- a/mmm-civi/sites/all/modules/civicrm/CRM/Core/BAO/Mapping.php
+++ b/mmm-civi/sites/all/modules/civicrm/CRM/Core/BAO/Mapping.php
@@ -727,6 +727,7 @@ class CRM_Core_BAO_Mapping extends CRM_Core_DAO_Mapping
                                 $noneArray[] = array( $x, $i, 2 );             
                             } else {
                                 $phoneType = isset($mappingPhoneType[$x][$i]) ? $mappingPhoneType[$x][$i] : null;
+                                $imProvider = isset($mappingImProvider[$x][$i]) ? $mappingImProvider[$x][$i] : null;
                                 
                                 if ( !$locationId && in_array($mappingName[$x][
                                     $locationId = " ";


Looking at the code also brings up two additional questions.

1. Should imProvider also be included in the defaults array a few lines below this patch?
2. Should the other branch of the if statement have some similar code?



ehowland

  • I’m new here
  • *
  • Posts: 25
  • Karma: 0
  • CiviCRM version: 3.3.5
  • CMS version: Drupal 6
  • MySQL version: various
  • PHP version: various
Re: Undefined variable: imProvider in CRM_Core_BAO_Mapping
September 12, 2011, 08:49:49 pm
moved to issue tracker

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Undefined variable: imProvider in CRM_Core_BAO_Mapping
September 13, 2011, 05:29:57 am
For tracking purpose: http://issues.civicrm.org/jira/browse/CRM-8852

Kurund
Found this reply helpful? Support CiviCRM

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Undefined variable: imProvider in CRM_Core_BAO_Mapping

This forum was archived on 2017-11-26.