1

this has me stumped, and wondering if anyone else has encountered it.

I have a profile search results page where the result table includes both standard fields and custom fields.

I am able to sort the table successfully on the standard fields by clicking the arrows/column headers, but the custom fields column sort fails. I see one of two errors:

  1. If I click the up/down arrows next to the column header text, a popup "Network Error Unable to reach the server. Please refresh this page in your browser and try again." appears, and a 500 server error is registered in the web server error log.

  2. If I click the column header text, I get a 404 page with the error message "Class name must be a valid object or a string"

You can see this in action live at https://www.fawco.org/index.php?option=com_civicrm&task=civicrm/profile&force=1&gid=18&reset=1&crmRowCount=100&Itemid=388 ("Name" and "Country" are default fields, "FAWCO Region" is a custom field.)

Per my testing:

  • Search itself works properly.
  • There are no errors in the CiviCRM log or the Joomla log.
  • Joomla and CiviCRM debug modes have not shown any errors.
  • web server logs report as described above, 500 for the sort request via arrow, 404 for the sort request via text.
  • Adding and removing different default and custom fields to the results makes no difference: default columns consistently work and custom consistently fail.

System is Joomla 3.9.10 with CiviCRM 5.15.1.

Has anyone seen this before, or could someone give me a hint where I could start troubleshooting?

8
  • Further investigation: monitoring the network traffic, it's this custom field sort request that is failing: fawco.org/index.php?option=com_civicrm&task=civicrm/… But the exact same format request for the standard data field sort is successful. I just have no idea where to start looking for the difference in behavior.
    – minbori
    Oct 2, 2019 at 11:30
  • Look in the apache error logs. It should give some info about the code file and line number where the "Class name must be a valid object or a string" error is happening.
    – Demerit
    Oct 2, 2019 at 13:16
  • There is no event in the Apache error logs. Am trying to test whether PHP errors are actually being logged.
    – minbori
    Oct 4, 2019 at 11:34
  • 1
    OK, so here's the error: [04-Oct-2019 15:53:43 UTC] PHP Fatal error: Class name must be a valid object or a string in /home/fawcoho/public_html/administrator/components/com_civicrm/civicrm/CRM/Contact/BAO/Query.php on line 6373
    – minbori
    Oct 4, 2019 at 16:02
  • Now I'm really not sure where to go next -- this is out-of-the-box CiviCRM code, nothing custom.
    – minbori
    Oct 4, 2019 at 16:33

1 Answer 1

1

For 5.15.1 you can add these lines just before line 6373 in CRM/Contact/BAO/Query.php.

if (empty($fieldSpec['bao'])) {
  continue;
}

There will also be a similar workaround put into 5.18.2 when it is released. https://github.com/civicrm/civicrm-core/pull/15454

1
  • Thanks, that worked! I also installed 5.18.2 today and the problem is gone.
    – minbori
    Oct 9, 2019 at 11:41

Your Answer

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

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