Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
function facetapi_map_assoc(&$array, $name, $key) {
$array[$key] = drupal_map_assoc($array[$key]);
}
A quick array_key_exists() check here would prevent any undefined index errors. The patched attached below does that. But note that the array_key_exists() here will end up creating a copy of $array, introducing a (probably, hopefully) slight performance overhead.
Comment | File | Size | Author |
---|---|---|---|
#2 | facetapi-2768779-facetapi_map_assoc-undefined-index.patch | 473 bytes | dags |
Comments
Comment #2
dags CreditAttribution: dags commentedComment #3
dags CreditAttribution: dags commentedComment #4
eugene.ilyin CreditAttribution: eugene.ilyin as a volunteer and at DrupalJedi commentedI cannot just apply it. I have to know how to reproduce the problem
Comment #5
andrezstar CreditAttribution: andrezstar commentedI did have the same error (when clearing caches so the facettes are generated in the map) when there was a declaration of the hook_facetapi_facet_info_alter to define a "map callback"
I did fix the error when I added the property "field api bundles"
So i let it like this:
$facet_info['my_field']['map callback'] = 'my_module_my_field_map_callback';
$facet_info['my_field']['field api bundles'] = array();
I guess the patch, aint absolutely needed but might be nice as well.
Comment #6
jyraya CreditAttribution: jyraya at European Commission and European Union Institutions, Agencies and Bodies commentedHello,
I was looking to this issue when I saw that the patch is already committed in the dev branch via #2373023: Undefined index: field api
If you check this commit, you will see that the #2 patch is already committed.
So for me, the current issue can be closed.
I put the state of the issue to "needs review" to allow maintainers to make a last check .