civicrm / org.civicrm.contactlayout

Customize the contact summary screen
Other
15 stars 20 forks source link

Warning: in_array() expects parameter 2 to be array, null given #127

Closed gillenpj closed 1 year ago

gillenpj commented 1 year ago

Hello. I've suddenly begun to get the following error, displayed at the top of each contact page.

Warning: in_array() expects parameter 2 to be array, null given in /home/embracingage/www/www/wp-content/uploads/civicrm/ext/org.civicrm.contactlayout/CRM/Contactlayout/BAO/ContactLayout.php on line 457

Even worse, however, is that the formatting of the contact page is now messed up. The issue goes away if I disable the extension, but comes back once I enable it. (In the screenshot below, notice all the space inserted between Summary and Contribution tabs.)

image

gillenpj commented 1 year ago

I found the source of this error. In my instance of CiviCRM, there is a custom data field set called "Volunteer Miscellaneous" which doesn't have any actual data fields in it, so it looks like it isn't needed anymore. When I moved Voluntary Miscellaneous from tab to inline that field set suddenly became important and because it was empty that caused a problem for Contact Layout Editor. I've disabled this (empty) custom field set and everything appears to work now. Phew.

savionlee commented 1 year ago

I found the source of this error. In my instance of CiviCRM, there is a custom data field set called "Volunteer Miscellaneous" which doesn't have any actual data fields in it, so it looks like it isn't needed anymore. When I moved Voluntary Miscellaneous from tab to inline that field set suddenly became important and because it was empty that caused a problem for Contact Layout Editor. I've disabled this (empty) custom field set and everything appears to work now. Phew.

worked for me. I had migrated my fields from a custom group and layout was unhappy. here was the stacktrace from wordpress:

[04-May-2023 12:49:42 America/Chicago] PHP Fatal error:  Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /bitna>
Stack trace:
#0 /bitnami/wordpress/wp-content/uploads/civicrm/ext/org.civicrm.contactlayout/CRM/Contactlayout/BAO/ContactLayout.php(457): in_array()
#1 /bitnami/wordpress/wp-content/uploads/civicrm/ext/org.civicrm.contactlayout/CRM/Contactlayout/BAO/ContactLayout.php(386): CRM_Contactlayout_BAO_ContactLa>
#2 /bitnami/wordpress/wp-content/uploads/civicrm/ext/org.civicrm.contactlayout/CRM/Contactlayout/BAO/ContactLayout.php(124): CRM_Contactlayout_BAO_ContactLa>
#3 [internal function]: CRM_Contactlayout_BAO_ContactLayout::getAllBlocks()
#4 /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/BasicGetAction.php(93): call_user_func()
#5 /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/BasicGetAction.php(52): Civi\Api4\Generic\BasicGetAction->getRecords()
#6 /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/Civi/Api4/Provider/ActionObjectProvider.php(72): Civi\Api4\Generic\BasicGetAction->_run()
#7 /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/Civi/API/Kernel.php(158): Civi\Api4\Provider\ActionObjectProvider->invoke()
#8 /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/Civi/Api4/Generic/AbstractAction.php(250): Civi\API\Kernel->runRequest()
#9 /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/api/api.php(85): Civi\Api4\Generic\AbstractAction->execute()
#10 /bitnami/wordpress/wp-content/uploads/civicrm/ext/org.civicrm.contactlayout/CRM/Contactlayout/Page/Base.php(15): civicrm_api4()
#11 /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(319): CRM_Contactlayout_Page_Base->run()
#12 /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(69): CRM_Core_Invoke::runItem()
#13 /bitnami/wordpress/wp-content/plugins/civicrm/civicrm/CRM/Core/Invoke.php(36): CRM_Core_Invoke::_invoke()
#14 /bitnami/wordpress/wp-content/plugins/civicrm/civicrm.php(1199): CRM_Core_Invoke::invoke()
#15 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(308): CiviCRM_For_WordPress->invoke()
#16 /opt/bitnami/wordpress/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters()
#17 /opt/bitnami/wordpress/wp-includes/plugin.php(517): WP_Hook->do_action()
#18 /opt/bitnami/wordpress/wp-admin/admin.php(259): do_action()
#19 {main}
  thrown in /bitnami/wordpress/wp-content/uploads/civicrm/ext/org.civicrm.contactlayout/CRM/Contactlayout/BAO/ContactLayout.php on line 457

after disabling the empty set, all was happy.

colemanw commented 1 year ago

This was fixed by #129