I'm upgrading to php 8 and receive an error when I try to index the search. It is related to the each() function which is evidently deprecated in php 8 and appears several times in the file.
I understand that foreach() should replace it, but how should that be rewritten in the context of the function?
function apachesolr_multilingual_date_default_indexing_callback_implementation($entity, $field_name, $index_key, array $field_info) {
$fields = array();
if (!empty($entity->{$field_name})) {
$field = $entity->$field_name;
$values = array();
if (array_key_exists($entity->language, $field) && is_array($field[$entity->language])) {
$values = $field[$entity->language];
}
else {
list($lang, $values) = <strong>each($field);</strong>
if (!is_array($values)) {
$values = array();
}
}
Thanks,
Comments
Comment #2
liam morlandComment #3
Zertimon commentedComment #4
Zertimon commentedCorrection.
Comment #5
Zertimon commentedComment #6
liam morland