When I search (with both the apachesolr and ds_search modules enabled) I get:

Strict warning: Creating default object from empty value in ds_search_search_page() (line 301 of ds_search.module).

This error only occurs when users are in the search results.

The attached patch seems to fix the warnings, but definitely needs review from someone who knows what they're doing. I just generated it with git show HEAD on my local repo, let me know if I need to do something else to get a usable format - but it's a very tiny change.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rwam’s picture

Thanks,

that's help a lot. I use ds_search to render Profiles from Profile2. And I must use the following lines to avoid all warnings:

switch ($build['search_results'][$id]['#entity_type']) {
  case 'taxonomy_term':
    $key = '#term';
    break;
  case 'profile2':
    $key = '#entity';
    break;
  case 'user':
    $key = '#account';
    break;

   default:
     $key = '#' . $build['search_results'][$id]['#entity_type'];
     break;
}

It works.

Ciao
Ralf

Christopher Riley’s picture

Thanks for the patch would like to see this committed.

aspilicious’s picture

Assigned: Unassigned » swentel
Status: Active » Reviewed & tested by the community

Assigning to swentel because he knows ds_search better than I do. If this throws warnings at the moment why does the user search work than?

erangakm’s picture

Attaching an apply-able patch for the same file as #1