The following error occurs when saving the Rendered HTML output field:
Fatal error: Nesting level too deep - recursive dependency? in /web/modules/contrib/search_api/src/Entity/Index.php on line 1418
Steps to reproduce:
- create a search index
- add Rendered HTML output field
- edit Rendered HTML output field
- save
Tested with PHP7.
The error is caused by the statement if ($old_processors != $new_processors) in Index.php in reactToProcessorChanges().
These arrays are compared recursively (by == operator) but the array itself contains recursive data:
Drupal\search_api\Plugin\search_api\processor\AggregatedFields Object
(
[index:protected] => Drupal\search_api\Entity\Index Object
(
[id:protected] => test
[name:protected] => test
[description:protected] =>
[read_only:protected] =>
[field_settings:protected] => Array
(
[title] => Array
(
[label] => Title
[datasource_id] => entity:node
[property_path] => title
[type] => string
)
[body] => Array
(
[label] => Body
[datasource_id] => entity:node
[property_path] => body
[type] => text
[dependencies] => Array
(
[config] => Array
(
[0] => field.storage.node.body
)
)
)
[rendered_item] => Array
(
[label] => Rendered HTML output
[datasource_id] =>
[property_path] => rendered_item
[type] => text
[configuration] => Array
(
[roles] => Array
(
[anonymous] => anonymous
)
[view_mode] => Array
(
[entity:node] => Array
(
[article] =>
[organisation] =>
[page] =>
[project] =>
[publication] =>
[researcher] =>
)
)
)
)
)
[fieldInstances:protected] => Array
(
[title] => Drupal\search_api\Item\Field Object
(
[index:protected] => Drupal\search_api\Entity\Index Object
*RECURSION*
Comments
Comment #2
mpp commentedComment #3
mpp commentedComment #4
drunken monkeyI couldn't reproduce this problem with your suggested steps. But it looks like it might indeed occur in appropriate circumstances (whatever those are).
I think we should probably just remove that check – we already check whether anything changed afterwards, and the small performance gain (if it even exists) is not worth the risk of a fatal error (or adding code that checks this manually). I don't see any functional purpose of that line.
Comment #5
borisson_This also means that the code ends up being simpler, I'm all for that!
Comment #6
mpp commentedTested and rtbc.
Comment #8
drunken monkeyCommitted.
Thanks again!