I have just upgraded my Drupal 6 site to the latest CiviCRM 4.7.4 All seemed to go well except that when I try to export contact records (using primary fields). I get the following fatal error:

Fatal error: Can't use function return value in write context in ../public_html/sites/all/modules/civicrm/CRM/Export/BAO/Export.php on line 435

Steps I followed: 1. Search for contacts 2. Select Export option 3. Select Export Primary fields 4. Press continue

Some help would be hugely appreciated!

Thanks Davy

  • 1
    This is a good question! To solve your problem, we'll need to see the expanded debugging information. In CiviCRM, please go to Administer menu > System Settings > Debugging and Error Handling, select "Yes" to both "Enable Debugging" and "Display Backtrace", and press "Save". Repeat the problem that caused your error, and you'll see much a much more detailed error. Please update this question with the expanded error and backtrace - and don't forget to disable debugging/backtrace when you're done! Commented Mar 19, 2016 at 17:11
  • I enabled the debug settings as suggested but still only get the one line error. No backtrace info at all. I cleared caches, switched off drupal caching, cleared Civi caches, deleted content of templates_c directory, tried in Chrome and Safari... but still only the one line. :-(
    – Davy Ivins
    Commented Mar 21, 2016 at 9:27

1 Answer 1


Line 435 in CRM/Export/BAO/Export.php that your error message is referring to says:

if (!empty(self::defaultReturnProperty($exportMode))) {

This will give an error in all PHP versions below 5.5. From the PHP manual (http://php.net/manual/en/function.empty.php):

Prior to PHP 5.5, empty() only supports variables; anything else will result in a parse error

You should be able to fix this by replacing lines 435-437 in Export.php with something like

  $key = self::defaultReturnProperty($exportMode);
  if ($key) {
    $returnProperties[$key] = 1;
  • Yes! That fixed it. Thanks very much for your help. :-) :-)
    – Davy Ivins
    Commented Mar 22, 2016 at 7:32
  • I keep running afoul of this because my laptop has a later version of PHP than my live server.
    – DaveFF
    Commented Mar 22, 2016 at 9:10
  • Should this be considered a bug? Is it already set up?
    – G H
    Commented Mar 29, 2016 at 16:06
  • I have reported this in the CiviCRM issue queue at issues.civicrm.org/jira/browse/CRM-18279 so it will hopefully be fixed in the next version.
    – reswild
    Commented Mar 31, 2016 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.