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

Error Shown When Exporting Contacts

    Details

    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      When error reporting is not turned off and no sort order is specified in an advanced contact search export, a PHP Warning is thrown:

      Warning: strpos() [function.strpos]: Empty needle in .../wp-content/plugins/civicrm/civicrm/CRM/Export/BAO/Export.php on line 709

      This then triggers multiple "headers already sent" error messages and the CSV file is not served.

      The original warning message is due to the variable $order being passed as the second parameter in strpos(). In CRM_Export_BAO_Export::exportComponents(), $order defaults to NULL. By the time the code gets to the aforementioned strpos() function, $order is unchanged and hence is an empty string for strpos() if a string wasn't passed to the function.

      If we simply wrap the conflicting code in an if($order) statement, the issue should be resolved. Fortunately, such an if statement is directly afterwards, so I would recommend just moving the strpos() code block into the following if($order) statement. I've checked this and it fixes the issue on my setup.

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              danbrellis Dan Brellis
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 10 minutes
                10m
                Remaining:
                Remaining Estimate - 10 minutes
                10m
                Logged:
                Time Spent - Not Specified
                Not Specified