#17572·mautic

Contact merge drops the losing contact's stage when the survivor has none

Author: adiuxCreated Sep 28, 2026Updated Sep 28, 2026
Labelsbugneeds-triage

Mautic Series

7.2.x series (verified against the 7.2 source branch)

Mautic installed version

Not verified in a running installation; found by reviewing the 7.2 contact merge implementation.

Way of installing

Not relevant to the source-level defect.

PHP version

Not relevant to the source-level defect.

What browsers are you seeing the problem on?

Not relevant.

What happened?

ContactMerger::merge($winner, $loser) transfers the losing contact's owner when the survivor has no owner, but does not transfer its stage. If the survivor has no stage and the losing contact has one, deleting the loser also loses the only assigned stage. The surviving contact should inherit the loser's stage when it does not already have one; if both contacts have a stage, the survivor should retain its own.

This differs from #12072, which was fixed in #12078 for the POST /api/contacts/new code path, and from #16266, where deduplication fails with an ORM exception for an existing stage.

Related: #16426 (merged into 7.x) changes the form submission merge order so the existing identified contact survives instead of the anonymous session contact. That preserves the existing contact's stage in that particular form flow when it has one. The 7.2 branch still uses the old merge order as of this report. Neither version of that form change transfers a stage that exists only on the losing contact; that is the separate ContactMerger behavior reported here.

How can we reproduce this issue?

  1. In a Mautic test installation, create two contacts, A and B, with different email addresses. Leave A without a stage and assign a stage to B.
  2. From contact A, use the contact Merge action to merge B into A, keeping A as the main contact.
  3. Reopen A and inspect its stage.

Expected: A inherits B's stage.

Predicted from the current code: A still has no stage, and B has been deleted. This sequence needs confirmation in a running installation. The same behavior can be reproduced directly by calling ContactMerger::merge($winner, $loser) with those stage assignments.

Relevant log output

No log output. The merge code currently has no stage transfer step.

Code of Conduct

I confirm that I have read and agree to follow this project's Code of Conduct.



Care about this issue? Want to get it resolved sooner? If you are a member of Mautic, you can add some funds to the Bounties Project so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs here.