I can see the following error in watchdog while uninstalling the module.

Recoverable fatal error: Object of class Drupal\Core\Field\BaseFieldDefinition could not be converted to string in webform_uninstall() (line 763 of /Applications/MAMP/htdocs/d8/modules/webform/webform.install).

CommentFileSizeAuthor
#5 fatal_error_on-2499781-5.patch693 bytessumitmadan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sumitmadan’s picture

Issue summary: View changes
fenstrat’s picture

Title: Fatar error on Uninstall » Fatal error on uninstall: BaseFieldDefinition could not be converted to string
Status: Active » Fixed

Committed and pushed to 8.x-4.x.

Thanks for the bug report.

I couldn't reproduce this at first until I traced it back to having devel installed. Turns out the devel calls set_error_handler('backtrace_error_handler'); which then handles this error and simply logs it to watchdog, because after all it is a *Recoverable* fatal error. Disabling devel results in the fatal printed to screen and the uninstall failing.

So my guess as to why this is happening is that calling array_diff_assoc() on $entity_manager->getBaseFieldDefinitions('node', 'webform') causes a string conversion on at least one of the values (a magic __toString() call?). The odd thing is it only effects $entity_manager->getBaseFieldDefinitions() and not $entity_manager->getFieldDefinitions. Odd. Thankfully once that all made sense it was just a matter of calling array_diff_key() which just looks at the keys rather than array_diff_assoc().

  • fenstrat committed 6a7e60c on 8.x-4.x
    Issue #2499781 by fenstrat: Fatal error on uninstall:...
sumitmadan’s picture

Status: Fixed » Needs work

$entity_manager->getBaseFieldDefinitions('node', 'webform') can be changed to $entity_manager->getBaseFieldDefinitions('node').

sumitmadan’s picture

Status: Needs work » Needs review
FileSize
693 bytes

Please review.

fenstrat’s picture

Status: Needs review » Fixed

Committed and pushed #5 to 8.x-4.x.

Good catch, thanks!

  • fenstrat committed d82dc1d on 8.x-4.x authored by sumitmadan
    Issue #2499781 by sumitmadan: Follow up for Fatal error on uninstall:...
DanChadwick’s picture

Category: Bug report » Task

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.