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

civicrm_api3 does not surface errors in chained API requests

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 4.7.15
    • Fix Version/s: None
    • Component/s: CiviCRM API
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      Developer Doc
    • Funding Source:
      Needs Funding
    • Verified?:
      No

      Description

      The civicrm_api3() function which detects error conditions in the response object and converts them to exceptions, does not check the results of chained API requests, which may have nested errors preventing the parent request from completing.

      Example response object wherein only a chained child request contains an error and is not detected and thrown by the civicrm_api3() wrapper:

      {{
      Array
      (
      [is_error] => 0
      [version] => 3
      [count] => 1
      [id] => 35107
      [values] => Array
      (
      [0] => Array
      (
      [id] => 35107
      [contact_type] => Individual
      [contact_sub_type] =>
      ... abbreviated for readability ...

      [api.address.replace] => Array
      (
      [error_code] => 2000
      [entity] => Address
      [action] => create
      [is_error] => 1
      [error_message] => Input variable `params` is not an array
      )

      }}

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              benjaminbradley Benjamin Bradley
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: