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

Error msg on profile for phone htmlspecialchars() expects parameter 1 to be string, array given

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.4.7, 4.0.7
    • Fix Version/s: 3.4.8
    • Component/s: None
    • Labels:
      None

      Description

      After R-35735 in some circumstances the phone default would be set to an array causing this message

      warning: htmlspecialchars() expects parameter 1 to be string, array given in /home/www-home/apps/civicrm-3.4.7/civicrm/packages/HTML/Common.php on line 144.

      R-35735 assumes that '$value['phone'] is either an array containing the location type or a string value. I captured it as an array with the phone number & the id from the phone number field.

      Array
      (
      [1_id] => 1471
      [1] => 021 123 555
      )

      Patch below makes the warning go away & returns us to the behaviour prior to R35735 - ie. if the location_type is not in the array then nothing is set as a default (with the E-Notice 35735 was intended to fix.).

      (Nb - if this is the right fix it should go into 3.4 / 4.0 on the basis that it seems to be risk-free & simply fixes a very new bug)

      Index: CRM/Core/BAO/UFGroup.php
      ===================================================================
      — CRM/Core/BAO/UFGroup.php (revision 37365)
      +++ CRM/Core/BAO/UFGroup.php (working copy)
      @@ -1990,7 +1990,7 @@
      if ( $phoneTypeId &&
      isset( $value['phone'][$phoneTypeId] ) )

      { $defaults[$fldName] = $value['phone'][$phoneTypeId]; - }

      else

      { + }

      elseif (!is_array(CRM_Utils_Array::value( 'phone', $value )))

      { $defaults[$fldName] = CRM_Utils_Array::value( 'phone', $value ); }

      } else if ( $fieldName == 'email' ) {

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: