Skip to content

Fixes PHP Fatal error when editing a Group which has at least 1 Parent Group

Fixes PHP Fatal error when editing a Group which has at least 1 Parent Group.

Steps to reproduce:

  1. Create a Group
  2. Set a Parent for the Group
  3. Edit the Group
  4. PHP Fatal error

PHP fatal error.

Got error 'PHP message: errorID:72f44cd56a74\nbackTrace:\n#0 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/API/Api3SelectQuery.php(100): CRM_Core_Error::backtrace()\n#1 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/API/SelectQuery.php(114): Civi\\API\\Api3SelectQuery->buildWhereClause()\n#2 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/api/v3/utils.php(1258): Civi\\API\\SelectQuery->run()\n#3 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/api/v3/GroupOrganization.php(28): _civicrm_api3_basic_get("CRM_Contact_DAO_GroupOrganization", (Array:4))\n#4 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_group_organization_get((Array:4))\n#5 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(156): Civi\\API\\Provide...PHP message: PHP Fatal error:  Uncaught TypeError: mysqli_real_escape_string(): Argument #2 ($string) must be of type string, array given in /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php:880\nStack trace:\n#0 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/vendor/pear/db/DB/mysqli.php(880): mysqli_real_escape_string()\n#1 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/packages/DB/DataObject.php(1851): DB_mysqli->escapeSimple()\n#2 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(2252): DB_DataObject->escape()\n#3 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/DAO.php(2978): CRM_Core_DAO::escapeString()\n#4 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/API/Api3SelectQuery.php(101): CRM_Core_DAO::createSQLFilter()\n#5 /v...', referer: https://my.org.au/wp-admin/admin.php?page=CiviCRM&q=civicrm%2Fgroup&reset=1

Stack trace.

#0 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/API/Api3SelectQuery.php(100): CRM_Core_Error::backtrace()
#1 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/API/SelectQuery.php(114): Civi\API\Api3SelectQuery->buildWhereClause()
#2 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/api/v3/utils.php(1258): Civi\API\SelectQuery->run()
#3 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/api/v3/GroupOrganization.php(28): _civicrm_api3_basic_get("CRM_Contact_DAO_GroupOrganization", (Array:4))
#4 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_group_organization_get((Array:4))
#5 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(156): Civi\API\Provider\MagicFunctionProvider->invoke((Array:8))
#6 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(79): Civi\API\Kernel->runRequest((Array:8))
#7 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/api/api.php(28): Civi\API\Kernel->runSafe("group_organization", "get", (Array:4))
#8 /var/www/vhosts/httpdocs/CRM/extensions/org.civicrm.multisite/multisite.php(536): civicrm_api("group_organization", "get", (Array:4))
#9 /var/www/vhosts/httpdocs/CRM/extensions/org.civicrm.multisite/multisite.php(518): _multisite_alter_form_crm_group_form_edit("CRM_Group_Form_Edit", Object(CRM_Group_Form_Edit))
#10 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(276): multisite_civicrm_buildForm("CRM_Group_Form_Edit", Object(CRM_Group_Form_Edit))
#11 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook/WordPress.php(136): CRM_Utils_Hook->runHooks((Array:62), "civicrm_buildForm", 2, "CRM_Group_Form_Edit", Object(CRM_Group_Form_Edit), NULL, NULL, NULL, NULL)
#12 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php(314): CRM_Utils_Hook_WordPress->invokeViaUF(2, "CRM_Group_Form_Edit", Object(CRM_Group_Form_Edit), NULL, NULL, NULL, NULL, "civicrm_buildForm")
#13 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(251): Civi\Core\CiviEventDispatcher::delegateToUF(Object(Civi\Core\Event\GenericHookEvent), "hook_civicrm_buildForm", Object(Civi\Core\UnoptimizedEventDispatcher))
#14 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/vendor/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners((Array:1), "hook_civicrm_buildForm", Object(Civi\Core\Event\GenericHookEvent))
#15 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/Civi/Core/CiviEventDispatcher.php(263): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(Civi\Core\Event\GenericHookEvent), "hook_civicrm_buildForm")
#16 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(168): Civi\Core\CiviEventDispatcher->dispatch("hook_civicrm_buildForm", Object(Civi\Core\Event\GenericHookEvent))
#17 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Hook.php(490): CRM_Utils_Hook->invoke((Array:2), "CRM_Group_Form_Edit", Object(CRM_Group_Form_Edit), NULL, NULL, NULL, NULL, "civicrm_buildForm")
#18 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Form.php(766): CRM_Utils_Hook::buildForm("CRM_Group_Form_Edit", Object(CRM_Group_Form_Edit))
#19 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/QuickForm/Action/Display.php(76): CRM_Core_Form->buildForm()
#20 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Controller.php(203): CRM_Core_QuickForm_Action_Display->perform(Object(CRM_Group_Form_Edit), "display")
#21 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/packages/HTML/QuickForm/Page.php(103): HTML_QuickForm_Controller->handle(Object(CRM_Group_Form_Edit), "display")
#22 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Controller.php(355): HTML_QuickForm_Page->handle("display")
#23 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Utils/Wrapper.php(98): CRM_Core_Controller->run()
#24 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(295): CRM_Utils_Wrapper->run("CRM_Group_Form_Edit", "Edit Group", (Array:0))
#25 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem((Array:17))
#26 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke((Array:3))
#27 /var/www/vhosts/httpdocs/wp-content/plugins/civicrm/civicrm.php(1232): CRM_Core_Invoke::invoke((Array:3))
#28 /var/www/vhosts/httpdocs/wp-includes/class-wp-hook.php(324): CiviCRM_For_WordPress->invoke("")
#29 /var/www/vhosts/httpdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters("", (Array:1))
#30 /var/www/vhosts/httpdocs/wp-includes/plugin.php(517): WP_Hook->do_action((Array:1))
#31 /var/www/vhosts/httpdocs/wp-admin/admin.php(259): do_action("toplevel_page_CiviCRM")
#32 {main}

Agileware Ref: CIVICRM-2225

Merge request reports

Loading