Author Topic: bug and patch: CRM_Core_BAO_CustomValueTable::setValues fails for 'Memo' fields  (Read 546 times)

Offline TwoMice

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 15
    • Emphanos
  • CiviCRM version: Always current stable version
  • CMS version: Drupal 7
When using CRM_Core_BAO_CustomValueTable::setValues to save a custom value of type Memo (a.k.a. Note / TextArea), this backtrace is produced:
Code: [Select]
/var/www/domains/civicrm/dev/drupal/sites/all/modules/civicrm/CRM/Core/Error.php, backtrace, 257
/var/www/domains/civicrm/dev/drupal/sites/all/modules/civicrm/CRM/Utils/Type.php, fatal, 167
/var/www/domains/civicrm/dev/drupal/sites/all/modules/civicrm/CRM/Core/BAO/CustomValueTable.php, escape, 494
/var/www/domains/civicrm/dev/drupal/sites/all/modules/tmcivi/TM/Raw/Raw/saveParticipantGroundTransportationData.php, setValues, 79
/var/www/domains/civicrm/dev/drupal/sites/all/modules/tmcivi/TM/Raw/Page.php, include, 48
/var/www/domains/civicrm/dev/drupal/sites/all/modules/civicrm/CRM/Core/Invoke.php, run, 215
/var/www/domains/civicrm/dev/drupal/sites/all/modules/civicrm/drupal/civicrm.module, invoke, 350
, civicrm_invoke,
/var/www/domains/civicrm/dev/drupal/includes/menu.inc, call_user_func_array, 348
/var/www/domains/civicrm/dev/drupal/index.php, menu_execute_active_handler, 18

With the error message:
unrecoverable error
    Sorry. A non-recoverable error has occurred.

    Cannot recognize Memo for


Apparently CRM_Utils_Type::escape() is not built to handle the Memo type, and so it errors out as the default response.

The attached patch fixes this problem by treating Memo in the same way as String.  I am not sure if this is the best fix, but since a memo column is string data, it seems to be right.

- TM
Please consider contributing to help improve CiviCRM with the Make it Happen! initiative.

Offline Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 14732
  • Karma: 440
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x

can u file an issue and attach this patch please :)

thanx

lobo
Found this reply helpful? Contribute NOW and help improve CiviCRM with the Make it Happen! initiative.

Offline TwoMice

  • I post frequently
  • ***
  • Posts: 192
  • Karma: 15
    • Emphanos
  • CiviCRM version: Always current stable version
  • CMS version: Drupal 7
Please consider contributing to help improve CiviCRM with the Make it Happen! initiative.