3

System Info

  • Wordpress ver. 5.5.3
  • SQL: 10.3.24-MariaDB-log-cll-lve - MariaDB Server
  • Server:
  • Cloudlinux 3.10.0-962.3.2.lve1.5.38.el7.x86_64
  • Apache 2.4.46
  • PHP 7.4

Issue is in both Civi ver 5.31.0 and 5.29 - persisted past update/upgrade.

Issue is that attempting to search for a respondent to reserve in civiCampaign creates a DB Error: Syntax error

The log states:

Nov 07 14:41:58 [debug] $backTrace = #0 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/Error.php(205): CRM_Core_Error::backtrace("backTrace", TRUE)

#1 /path/to/site//wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(922): CRM_Core_Error::handle(Object(DB_Error))

#2 /path/to/site//wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB.php(997): PEAR_Error->__construct("DB Error: syntax error", -2, 16, (Array:2), "\nINSERT INTO civicrm_prevnext_cache (cachekey, entity_id1, data)\n\n      SE...")

#3 /path/to/site//wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(575): DB_Error->__construct(-2, 16, (Array:2), "\nINSERT INTO civicrm_prevnext_cache (cachekey, entity_id1, data)\n\n      SE...")

#4 /path/to/site//wp-content/plugins/civicrm/civicrm/vendor/pear/pear-core-minimal/src/PEAR.php(223): PEAR::_raiseError(Object(DB_mysqli), NULL, -2, 16, (Array:2), "\nINSERT INTO civicrm_prevnext_cache (cachekey, entity_id1, data)\n\n      SE...", "DB_Error", TRUE)

#5 /path/to/site//wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php(1928): PEAR->__call("raiseError", (Array:7))

#6 /path/to/site//wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php(936): DB_common->raiseError(-2, NULL, NULL, "\nINSERT INTO civicrm_prevnext_cache (cachekey, entity_id1, data)\n\n      SE...", "1064 ** You have an error in your SQL syntax; check the manual that correspon...")

#7 /path/to/site//wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php(406): DB_mysqli->mysqliRaiseError()

#8 /path/to/site//wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/common.php(1234): DB_mysqli->simpleQuery("\nINSERT INTO civicrm_prevnext_cache (cachekey, entity_id1, data)\n\n      SE...")

#9 /path/to/site//wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(2696): DB_common->query("\nINSERT INTO civicrm_prevnext_cache (cachekey, entity_id1, data)\n\n      SE...")

#10 /path/to/site//wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1829): DB_DataObject->_query("\nINSERT INTO civicrm_prevnext_cache (cachekey, entity_id1, data)\n\n      SE...")

#11 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(457): DB_DataObject->query("\nINSERT INTO civicrm_prevnext_cache (cachekey, entity_id1, data)\n\n      SE...")

#12 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(1563): CRM_Core_DAO->query("\nINSERT INTO civicrm_prevnext_cache (cachekey, entity_id1, data)\n\n      SE...", TRUE)

#13 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/PrevNextCache/Sql.php(43): CRM_Core_DAO::executeQuery("\nINSERT INTO civicrm_prevnext_cache (cachekey, entity_id1, data)\n\n      SE...", (Array:1), FALSE)

#14 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Campaign/Selector/Search.php(274): CRM_Core_PrevNextCache_Sql->fillWithSql("civicrm search 2fedcb1a2b91b5337b15b83d001a4da5e9fdb2c76fbcc44ca3c12ce5d6dc9f...", "\n      SELECT %1, contact_a.id, contact_a.display_name\nFROM  FROM civicrm_c...", (Array:1))

#15 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Campaign/Selector/Search.php(244): CRM_Campaign_Selector_Search->buildPrevNextCache(Object(CRM_Utils_Sort))

#16 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/Selector/Controller.php(402): CRM_Campaign_Selector_Search->getRows(4, 0, 50, Object(CRM_Utils_Sort), 1, NULL)

#17 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/Selector/Controller.php(324): CRM_Core_Selector_Controller->getRows(Object(CRM_Core_Selector_Controller))

#18 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Campaign/Form/Search.php(287): CRM_Core_Selector_Controller->run()

#19 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(514): CRM_Campaign_Form_Search->postProcess()

#20 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Refresh.php(57): CRM_Core_Form->mainProcess()

#21 /path/to/site//wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Refresh->perform(Object(CRM_Campaign_Form_Search), "refresh")

#22 /path/to/site//wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Campaign_Form_Search), "refresh")

#23 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(347): HTML_QuickForm_Page->handle("refresh")

#24 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(312): CRM_Core_Controller->run((Array:3), NULL)

#25 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(68): CRM_Core_Invoke::runItem((Array:15))

#26 /path/to/site//wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3))

#27 /path/to/site//wp-content/plugins/civicrm/civicrm.php(1644): CRM_Core_Invoke::invoke((Array:3))

#28 /path/to/site//wp-includes/class-wp-hook.php(287): CiviCRM_For_WordPress->invoke("")

#29 /path/to/site//wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters("", (Array:1))

#30 /path/to/site//wp-includes/plugin.php(478): WP_Hook->do_action((Array:1))

#31 /path/to/site//wp-admin/admin.php(259): do_action("toplevel_page_CiviCRM")

#32 {main}

2
  • Do you get errors trying to do any other contact searches? Does clearing the CiviCRM caches help at all?
    – Aidan
    Commented Nov 9, 2020 at 18:34
  • @Aidan The default "find contact" search works, and the advance contact search works as well. Commented Nov 9, 2020 at 19:37

2 Answers 2

3

Welcome to CiviCRM Stack Exchange ... and congratulations on finding a bug!

I've created an issue and a Pull Request (PR). It is a very simple code change so if you can apply the change in the PR, test that it works for you and then leave a comment on the PR we should be able to get this resolved.

1
  • I've tested the edit made in the pull request and confirmed that it fixes the issue. The pull request has been reviewed and "approved" accordingly. Thank you for your help! Commented Nov 10, 2020 at 2:52
0

This error is still present in 5.32.2 but simple edit of one file as identified on https://github.com/civicrm/civicrm-core/pull/18948 temporarily fixes it

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.