Uploaded image for project: 'CiviVolunteer'
  1. CiviVolunteer
  2. VOL-237

Installer expects access to CiviVolunteer settings before they are available


    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.1.0
    • Fix Version/s: 2.2
    • Labels:
    • Documentation Required?:


      Observed Behavior

      The following error appears when installing CiviVolunteer, if error reporting is turned up high enough:

      Warning: Illegal string offset 'type' in /path/to/web/root/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/Setting.php on line 293

      Warning: Cannot modify header information - headers already sent by (output started at /path/to/web/root/wp-content/plugins/civicrm/civicrm/CRM/Core/BAO/Setting.php:293) in /path/to/web/root/wp-content/plugins/civicrm/civicrm/CRM/Utils/System/Base.php on line 895

      (Discovered while installing onto CiviCRM 4.7.9, but probably applies to other versions.)


      The impact is minor:

      • Production sites should not display error messages, so this wouldn't present to most users.
      • If error reporting is turned up, the installation process white-screens. This is not as bad as it seems, however. The installation is completed, but because there was output, the headers can't be modified, so the redirect back to the Manage Extensions page fails.
      • If the API call that triggers the warning were to fail, it would just mean that the example custom fields that CiviVolunteer creates (e.g. camera skill level) would not be flagged to be transformed by the slider widget. Users can set these however they like post-install.


      The warning is raised in _volunteer_update_slider_fields, but only during the install process. The CiviVolunteer installer creates some custom fields in CRM_Volunteer_Upgrader->createVolunteerContactCustomFields, at the end of which it calls _volunteer_update_slider_fields to flag the fields for use by the slider widget. Kicking everything off is the extension's hook_civicrm_install implementation, which calls CRM_Volunteer_Upgrader->install().

      The slider widget fields are tracked in a CiviVolunteer setting called slider_widget_fields. The setting is declared in extension_root/settings/volunteer.setting.php, but CiviCRM does not read this file until hook_civicrm_alterSettingsFolders is fired.

      When an extension is installed, the extension's hook_civicrm_install is run before its hook_civicrm_alterSettingsFolders. As a result, if the installer needs to reference settings declared by the extension, some special handling is required.

      Proposed Approach

      Run the code in question after the installation. This can be done using hook_civicrm_postInstall or in the upgrader once this civix pull request is merged.




            • Assignee:
              ginkgomzd Michael Z Daryabeygi
              pittstains Frank J. Gómez
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: