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

Contribute Page: Empty credit card field yields error

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.8
    • Fix Version/s: 2.0
    • Component/s: CiviContribute
    • Labels:
      None

      Description

      If the credit card field on a contribute page is left blank and the form is submitted, the following error displays:

      Warning: str_repeat() [function.str-repeat]: Second argument has to be greater than or equal to 0. in /home/fiasiorg/public_html/joomla15/administrator/components/com_civicrm/civicrm/CRM/Utils/System.php on line 459

      The following changes to the function at that line corrects the problem, but I'm unsure at this point if there are other implications to the fix:

      static function mungeCreditCard( $number, $keep = 4 ) {
      if ( $number !== '' )

      { $replace = str_repeat( '*' , strlen( $number ) - $keep ); }

      return substr_replace( $number, $replace, 0, -$keep );
      }

        Attachments

          Activity

            People

            • Assignee:
              sunil Sunil Pawar
              Reporter:
              lcdweb Brian Shaughnessy
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: