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.
When a user has translations and we click "Cancel account " on /user/[uid]/edit, it throws a fatal error:
Error: Call to undefined method Drupal\user\Entity\User::getEntity() in Drupal\content_translation\ContentTranslationHandler->entityFormDelete() (line 681)
Juste the line before, there is this code:
$form_object = $form_state->getFormObject()->getEntity();
I think it should be:
$form_object = $form_state->getFormObject();
Comment | File | Size | Author |
---|---|---|---|
#7 | drupal-translated_user_delete_error-2943646-7-8.5.x.patch | 1.94 KB | SylvainM |
Comments
Comment #2
SylvainM CreditAttribution: SylvainM at Axess Open Web Services commentedAttached patch fixes the error
Comment #3
BerdirLooks correct, but how are we not testing this... definitely needs tests :)
Also at least major.
Comment #4
borisson_Adding needs tests per #3.
Comment #5
SylvainM CreditAttribution: SylvainM at Axess Open Web Services commentedI will try to add tests this week
Comment #6
dravenkIf
$form_state->getFormObject()
not return a entity. what is return from there? Sorry, I can't repeat it. Can you provide the more detailed reproduction steps.?Comment #7
SylvainM CreditAttribution: SylvainM at Axess Open Web Services commentedWith some delay, I added this test.
Hope this is correct
Comment #9
borisson_This looks super solid, I like the test and it fails without the fix, so great work!
Comment #10
kala4ekJust checked at freshly 8.6.x
Works like a charm.
Comment #12
MixologicTemporary testbot hiccup.
Comment #13
catchIt looks to me like this would fail for untranslated user deletion too - should we add test coverage for that? (And also change the issue title?)
Comment #14
BerdirWe have lots of tests for deleting untranslated users IMHO.
This is in the content translation handler, that thing is never called if it is not translatable. It is called by \Drupal\content_translation\ContentTranslationHandler::entityFormAlter() as a delete submit callback, which in turn is called by content_translation_form_alter() if the entity type is marked as translatable.
Comment #15
catchGood point.
Committed/pushed to 8.6.x and cherry-picked to 8.5.x. Thanks!