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

PayPalImpl.php line 385 - urlencode() error for passing an array instead of a string

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 2.1.4
    • Fix Version/s: 2.2.0
    • Component/s: CiviContribute
    • Labels:
      None

      Description

      Version 2.1.4

      We use PayPal Standard to process payments. When a user selects to contribute some amount they must fill out a custom profile which includes basic address information. Included in that info is a state_province dropdown, but because it's not guaranteed to have every single possible state/province/region in the world, we don't make it required, and instead offer a blank text box for people to enter the info if their's couldn't be found in the dropdown. When this field (state_province) is left blank and the user returns from PayPal to the "Thank You" page, at the top of the page is an error box about urlencode() being passed an array() when it only accepts a string. The contribution is recorded just fine, but the error causes distrust in the user.

      The root of the problem seems to be on line 343 in the call to method CRM_Core_PseudoConstant::stateProvinceAbbreviation( $value ). In this case $value is empty, and so it returns an array of every possible state_province abbreviation. This array later gets passed to urlencode() on line 385, causing the error.

      There are two likely solutions:

      1) Never pass an empty string or null value to the method CRM_Core_PseudoConstant::stateProvinceAbbreviation() in the first place.
      2) Have CRM_Core_PseudoConstant::stateProvinceAbbreviation() return a null value or empty string if it's passed the same.

        Attachments

          Activity

            People

            • Assignee:
              sunil Sunil Pawar
              Reporter:
              nkinkade Nathan Kinkade
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: