I was not able to reproduce the issue on vanilla installation, but happens every time on our project.
Drupal Version
10.6.2
Domain module version
2.0.x-dev and 2.0.0-rc1
Expected Behavior
No fatal PHP error, reloading the error page should not delete the source page!
Actual Behavior
Step 5. and 6.
Steps to reproduce
1. Create article content type in Finnish, translate the article to English.
2. Go to English content /en/node/{nid}/edit and press "Delete translation" link.
3. Url is /en/node/{nid}/delete?destination=/en/node/{nid}/edit
4. Confirm deletion by pressing "Delete English translation" button.
5. Translation gets deleted (on database level), but we get PHP error: "InvalidArgumentException: The entity object refers to a removed translation (en) and cannot be manipulated."
On logs there's also:
InvalidArgumentException: The entity object refers to a removed translation (en) and cannot be manipulated. in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 609 of /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php).
Warning: Undefined array key "en" in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 608 of /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php)
Warning: Trying to access array offset on null in Drupal\Core\Entity\ContentEntityBase->getTranslatedField() (line 608 of /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php)
6. Reload the page /en/node/{nid}/delete?destination=/en/node/{nid}/edit and also the Finnish source node is deleted and user goes to 404 page.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3568699-catch-exception.patch | 1.18 KB | sokru |
Issue fork domain-3568699
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
sokru commentedAttached a patch that works for us.
Comment #3
mably commentedWithout a reproducible scenario on a fresh Drupal instance we won't be able to help much.
Comment #4
mably commentedLooks like an easy fix though.
Let's see what we can do here.
Comment #6
mably commentedHi @sokru, can you give a try to this issue's MR?
Not sure we want to log anything if it's a normal behavior in fact.
Can you tell us more about it?
Comment #8
sokru commented@mably thanks for the swift reply. The MR removes the fatal error, but there's two warnings
and
Comment #9
mably commentedGeez, looks like I messed up and pushed another fix directly on branch 2.0.x...
Comment #12
mably commented@sokru can you try MR 305 and see if it fixes your problem?
I tried a more targeted approach.
Hopefully it should get rid of those warnings.
Comment #14
mably commentedComment #15
sokru commentedMR 305 works nicely!
Comment #19
mably commented