Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Trivial
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.6.15
-
Fix Version/s: 4.7.11
-
Component/s: None
-
Labels:None
-
Documentation Required?:None
-
Funding Source:Contributed Code
Description
Observed on CiviCRM 4.6.15 but likely to affect others.
In _civicrm_api3_deprecated_activity_buildmailparams() we use $result['from']['id'] for the contact ID of the activity source.
If this value is not an integer, the generated SQL is invalid. CiviCRM will throw an exception and discard this inbound email.
Jul 26 04:07:10 [info] $backTrace = #0 /srv/www/example/example.org/sites/all/modules/civicrm/CRM/Core/Error.php(897): CRM_Core_Error::backtrace("backTrace", TRUE) #1 [internal function](): CRM_Core_Error::exceptionHandler(Object(DB_Error)) #2 /srv/www/example/example.org/sites/all/modules/civicrm/packages/PEAR.php(931): call_user_func((Array:2), Object(DB_Error)) #3 /srv/www/example/example.org/sites/all/modules/civicrm/packages/DB.php(976): PEAR_Error->PEAR_Error("DB Error: syntax error", -2, 16, (Array:2), "\nSELECT count(*)\n FROM civicrm_contact\n WHERE id IN ( ) [nativecode=10...") #4 /srv/www/example/example.org/sites/all/modules/civicrm/packages/PEAR.php(564): DB_Error->DB_Error(-2, 16, (Array:2), "\nSELECT count(*)\n FROM civicrm_contact\n WHE RE id IN ( ) [nativecode=10...") #5 /srv/www/example/example.org/sites/all/modules/civicrm/packages/DB/common.php(1905): PEAR->raiseError(NULL, -2, NULL, NULL, "\nSELECT count(*)\n FROM civicrm_contac t\n WHERE id IN ( ) [nativecode=10...", "DB_Error", TRUE) #6 /srv/www/example/example.org/sites/all/modules/civicrm/packages/DB/mysql.php(895): DB_common->raiseError(-2, NULL, NULL, NULL, "1064 ** You have an error in your SQL s yntax; check the manual that correspon...") #7 /srv/www/example/example.org/sites/all/modules/civicrm/packages/DB/mysql.php(328): DB_mysql->mysqlRaiseError() #8 /srv/www/example/example.org/sites/all/modules/civicrm/packages/DB/common.php(1216): DB_mysql->simpleQuery("\nSELECT count(*)\n FROM civicrm_contact\n WHERE id IN ( )") #9 /srv/www/example/example.org/sites/all/modules/civicrm/packages/DB/DataObject.php(2442): DB_common->query("\nSELECT count(*)\n FROM civicrm_contact\n WHERE id IN ( )") #10 /srv/www/example/example.org/sites/all/modules/civicrm/packages/DB/DataObject.php(1634): DB_DataObject->_query("\nSELECT count(*)\n FROM civicrm_contact\n WHERE i d IN ( )") #11 /srv/www/example/example.org/sites/all/modules/civicrm/CRM/Core/DAO.php(321): DB_DataObject->query("\nSELECT count(*)\n FROM civicrm_contact\n WHERE id IN ( )") #12 /srv/www/example/example.org/sites/all/modules/civicrm/CRM/Core/DAO.php(1222): CRM_Core_DAO->query("\nSELECT count(*)\n FROM civicrm_contact\n WHERE id IN ( )", T RUE) #13 /srv/www/example/example.org/sites/all/modules/civicrm/api/v3/Activity.php(383): CRM_Core_DAO::singleValueQuery("\nSELECT count(*)\n FROM civicrm_contact\n WHERE id IN ( )") #14 /srv/www/example/example.org/sites/all/modules/civicrm/api/v3/Activity.php(62): _civicrm_api3_activity_check_params((Array:8)) #15 /srv/www/example/example.org/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_activity_create((Array:8)) #16 /srv/www/example/example.org/sites/all/modules/civicrm/Civi/API/Kernel.php(96): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9)) #17 /srv/www/example/example.org/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel->run("activity", "create", (Array:8), NULL) #18 /srv/www/example/example.org/sites/all/modules/civicrm/CRM/Utils/Mail/EmailProcessor.php(258): civicrm_api("activity", "create", (Array:8)) #19 /srv/www/example/example.org/sites/all/modules/civicrm/CRM/Utils/Mail/EmailProcessor.php(111): CRM_Utils_Mail_EmailProcessor::_process(FALSE, Object(CRM_Core_DAO_MailSettings)) #20 /srv/www/example/example.org/sites/all/modules/civicrm/api/v3/Job.php(386): CRM_Utils_Mail_EmailProcessor::processActivities() #21 /srv/www/example/example.org/sites/all/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_job_fetch_activities((Array:1)) #22 /srv/www/example/example.org/sites/all/modules/civicrm/Civi/API/Kernel.php(96): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9)) #23 /srv/www/example/example.org/sites/all/modules/civicrm/api/api.php(23): Civi\API\Kernel->run("job", "fetch_activities", (Array:1), NULL) #24 /srv/www/example/example.org/sites/all/modules/civicrm/drupal/drush/civicrm.drush.inc(1539): civicrm_api("job", "fetch_activities", (Array:1)) #25 [internal function](): drush_civicrm_api("job.fetch_activities") #26 /usr/local/src/drush/includes/command.inc(366): call_user_func_array("drush_civicrm_api", (Array:1)) #27 /usr/local/src/drush/includes/command.inc(217): _drush_invoke_hooks((Array:34), (Array:1)) #28 [internal function](): drush_command("job.fetch_activities") #29 /usr/local/src/drush/includes/command.inc(185): call_user_func_array("drush_command", (Array:1)) #30 /usr/local/src/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch((Array:34)) #31 /usr/local/src/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch() #32 /usr/local/src/drush/drush.php(12): drush_main() #33 {main}