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.
Whenever we try to index content which has a value in the country field, we get the following error:
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Cannot use object of type Entity as array in
/path/to/drupal/install/includes/common.inc, line 5842
As you can see we are using drush to index the content.
When i delete the country field value - the indexing works fine.
Any idea why this might be happening?
Comments
Comment #1
gargsuchi CreditAttribution: gargsuchi commentedComment #2
gargsuchi CreditAttribution: gargsuchi commentedOK, so I was able to pinpoint the exact line which was the culprit -
File - countries.fields.inc - line #59
$items[$id][$delta]['country'] = $country;
If I comment this out, the indexing goes through fine. Any idea if this has an adverse effect?
Comment #3
Alan D. CreditAttribution: Alan D. commentedWhat code does line 5842 run?
Better yet, what is the trace where this happens?
In one of your module files (i.e. a custom one)
And just before the error (Line 5841)
And copy and paste the watchdog results here.
Cheers
Comment #4
gargsuchi CreditAttribution: gargsuchi commentedWhat code does line 5842 run?
This is the first line in the drupal_render function
I added the following code above this line:
And this gave me an output of an element of the type country.
Hope this helps.
Comment #5
Alan D. CreditAttribution: Alan D. commentedfor some reason, there is an incorrect FAPI call to the country item field. So the trace would help see where this is being called from.
So can you add this?
Comment #6
vaibhavjainAlan,
I added the following code
And the backtrace output is here