-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
APIAnything related to the APIAnything related to the APIT2Medium difficulty to fix (issue) or test (PR)Medium difficulty to fix (issue) or test (PR)bugIssues or PR's relating to bugsIssues or PR's relating to bugscontactsAnything related to contactsAnything related to contactsstaleIssues which have not received an update within 90 daysIssues which have not received an update within 90 days
Description
Mautic Version
4.4.x series
PHP version
8.0.30
What browsers are you seeing the problem on?
Not relevant
What happened?
mautic.CRITICAL: Uncaught PHP Exception Doctrine\ORM\ORMInvalidArgumentException: "Detached entity Mautic\LeadBundle\Entity\Lead with ID #51245 cannot be removed"
How can we reproduce this issue?
Saw this in a queue system.
Step 1: Send a bulk contact edit API request with the same contact ID for edit twice
Step 2: Witness crash
Error stems down to BatchIdToEntityHelper
being smart and being able to load an entity once and assign it twice in the returned entity map.
However, CommonApiController::processBatchForm assumes that entities appear and detaches them while processing - so if an entity appears twice - the second time round you are working on a detached entity.
Likely processBatchForm
needs to update $entities
if the one being detached is still in it, to replace it with the new one.
Relevant log output
No response
Code of Conduct
- I confirm that I have read and agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
APIAnything related to the APIAnything related to the APIT2Medium difficulty to fix (issue) or test (PR)Medium difficulty to fix (issue) or test (PR)bugIssues or PR's relating to bugsIssues or PR's relating to bugscontactsAnything related to contactsAnything related to contactsstaleIssues which have not received an update within 90 daysIssues which have not received an update within 90 days