API outputs on entity Contact kills contact search
This was a difficult one: The quicksearch started failing, as did advanced search and I couldn't work out why.
It seems that if you have an API output whose entity is Contact (I had
getjournos as the action) then it affects the getfields API call which in turn then means API calls are missing their default values from the schema.
In turn this leads to a SQL query with an empty
$table_name variable so the SQL is like
WHERE ( .sort_name = %1 ) which causes a DB error, as you can imagine.
Using a custom entity name fixes the problem.
- If it's envisaged that we should not be using existing entities, we should have validation.
- If we are supposed to be able to use existing entities, we need to fix this, and/or provide other validation if there are any specific cases that will break Civi.
This was found on the master branch at 946d0db5