A webform I created, which creates a civicrm contact/individual, sometimes does not submit cleanly. I don't know why or how that fails. What I DO know is that the civicrm back-end integration module falls off the rail when this happens. All attempts to view 'result' throws fatal error. "DB Syntax Error" through civi error handler.

It seems to me that the module reads a list of webform submissions that OUGHT to be there, and then doesn't check whether the submission components are ACTUALLY there, resulting in a SQL faux pas: SELECT ... WHERE id IN (1716,,1719) ...

Related issue: same thing happens when saving the webform as draft but then with "... IN() ..." - will create separate issue in a second for that with separate trace. Feel free to merge the tickets if that makes more sense.

Trace below:

Feb 15 15:46:06 [info] $Fatal Error Details = Array
(
[callback] => Array
(
[0] => CRM_Core_Error
[1] => handle
)

[code] => -2
[message] => DB Error: syntax error
[mode] => 16
[debug_info] => SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1719)' at line 1]
[type] => DB_Error
[user_info] => SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1719)' at line 1]
[to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719) [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1719)' at line 1]"]
)

Feb 15 15:46:06 [info] $backTrace = #0 /var/www/html/drupal-7.24/sites/all/modules/civicrm/CRM/Core/Error.php(197): CRM_Core_Error::backtrace("backTrace", TRUE)
#1 [internal function](): CRM_Core_Error::handle(Object(DB_Error))
#2 /var/www/html/drupal-7.24/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error))
#3 /var/www/html/drupal-7.24/sites/all/modules/civicrm/packages/DB.php(969): PEAR_Error->PEAR_Error("DB Error: syntax error", -2, 16, (Array:2), "SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719) [native...")
#4 /var/www/html/drupal-7.24/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-2, 16, (Array:2), "SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719) [native...")
#5 /var/www/html/drupal-7.24/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -2, NULL, NULL, "SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719) [native...", "DB_Error", TRUE)
#6 /var/www/html/drupal-7.24/sites/all/modules/civicrm/packages/DB/mysql.php(898): DB_common->raiseError(-2, NULL, NULL, NULL, "1064 ** You have an error in your SQL syntax; check the manual that correspon...")
#7 /var/www/html/drupal-7.24/sites/all/modules/civicrm/packages/DB/mysql.php(327): DB_mysql->mysqlRaiseError()
#8 /var/www/html/drupal-7.24/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719)")
#9 /var/www/html/drupal-7.24/sites/all/modules/civicrm/packages/DB/DataObject.php(2421): DB_common->query("SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719)")
#10 /var/www/html/drupal-7.24/sites/all/modules/civicrm/packages/DB/DataObject.php(1613): DB_DataObject->_query("SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719)")
#11 /var/www/html/drupal-7.24/sites/all/modules/civicrm/CRM/Core/DAO.php(158): DB_DataObject->query("SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719)")
#12 /var/www/html/drupal-7.24/sites/all/modules/civicrm/CRM/Core/DAO.php(905): CRM_Core_DAO->query("SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719)", TRUE)
#13 /var/www/html/drupal-7.24/sites/all/modules/civicrm/webform_civicrm/webform_civicrm.module(268): CRM_Core_DAO::executeQuery("SELECT id, display_name FROM civicrm_contact WHERE id IN (1716,,1719)")
#14 /var/www/html/drupal-7.24/sites/all/modules/civicrm/webform/includes/webform.submissions.inc(734): webform_civicrm_webform_submission_load((Array:4))
#15 /var/www/html/drupal-7.24/sites/all/modules/civicrm/webform/includes/webform.report.inc(37): webform_get_submissions("2", (Array:5), "50")
#16 [internal function](): webform_results_submissions(Object(stdClass), FALSE, "50")
#17 /var/www/html/drupal-7.24/includes/menu.inc(517): call_user_func_array("webform_results_submissions", (Array:3))
#18 /var/www/html/drupal-7.24/index.php(21): menu_execute_active_handler()
#19 {main}

Comments

eMMeMM’s picture

  • Commit e3ff6cd on 7.x-4.x by colemanw:
    Issue #2197209 - Don't lookup contact without an id
    
colemanw’s picture

Priority: Major » Normal
Status: Active » Fixed

I just committed the above patch. Can you confirm it fixes the problem? Does it also fix the related issue?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.