Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-6386

CRM_Core_OptionValue::addOptionValue crashes if it tries to create a new option group

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.2
    • Component/s: Core CiviCRM
    • Labels:
      None

      Description

      If you try to create an option value with CRM_Core_OptionValue::addOptionValue() where the option group does not yet exist, the code attempts to create the new option group for you. However, Civi crashes when it gets to an invocation of CRM_Utils_Weight::getDefaultWeight (currently at line 204), because require_once() is never called in that code path.

      I enclose a patch, and a PHPUnit test that exposes the issue on the unpatched code.

        Attachments

        1. CrashAddOptionValue.php
          1 kB
          Rob Thorne
        2. CRM-6386.diff
          1 kB
          Rob Thorne
        3. output-after-fix.txt
          1 kB
          Rob Thorne
        4. output-before-fix.txt
          6 kB
          Rob Thorne

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              torenware Rob Thorne
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: