mautic-extended-field
mautic-extended-field copied to clipboard
An error when an anonymous trying to submit a form with an email field and to merge with an existing contact.
Mautic: 2.16.0 Extended Fields: 2.15 PHP: 7.1.33
An error when an anonymous trying to submit a form with an email field and to merge with a contact.
It occurs inside the createLeadFromSubmit
method of the Mautic\FormBundle\Model\SubmissionModel
class because to access the repository of the lead uses the getRepository
method directly from Doctrine\ORM\EntityManager
class.
Steps to reproduce
- Create an extended custom field, for example: my_extended_field;
- Create a form with the email and the points fields and bind them to the custom fields of a contact, for example: Email: email Points: points
- Create a contact with filled an email only.
- Put your form to a website.
- Go to your website page with your form like an anonymous and try to submit the form.
- After form submission you will get en error.
The error log:
500 Internal Server Error - PHP Notice - Undefined index: my_extended_field
Symfony\Component\Debug\Exception\ContextErrorException
/app/bundles/LeadBundle/Deduplicate/ContactMerger.php:201 at
/app/bundles/LeadBundle/Deduplicate/ContactMerger.php:201 at Mautic\CoreBundle\ErrorHandler\ErrorHandler -> handleError ( '8', 'PHP Notice - Undefined index: my_extended_field', '/var/www/html/app/bundles/LeadBundle/Deduplicate/ContactMerger.php', '201', array('winner' => object(Lead), 'loser' => object(Lead), 'loserDate' => object(DateTime), 'winnerDate' => object(DateTime), 'newest' => object(Lead), 'oldest' => object(Lead), 'newestFields' => array('id' => '1431', 'title' => null, 'firstname' => null, 'lastname' => null, 'company' => null, 'position' => null, 'email' => null, 'mobile' => null, 'phone' => null, 'points' => '0', 'address1' => null, 'address2' => null, 'city' => null, 'state' => null, 'zipcode' => null, 'country' => null, 'preferred_locale' => null, 'timezone' => 'Europe/Paris', 'last_active' => '2020-06-25 13:21:55', 'attribution_date' => null, 'attribution' => null, 'my_extended_field' => '20'), 'oldestFields' => array('id' => '1430', 'title' => null, 'firstname' => null, 'lastname' => null, 'company' => null, 'position' => null, 'email' => '[email protected]', 'mobile' => null, 'phone' => null, 'points' => '0', 'address1' => null, 'address2' => null, 'city' => null, 'state' => null, 'zipcode' => null, 'country' => null, 'preferred_locale' => null, 'timezone' => null, 'last_active' => null, 'attribution_date' => null, 'attribution' => null), 'field' => 'my_extended_field', 'newValue' => '2020-06-25 13:21:55', 'fromValue' => 'empty', 'exception' => object(ValueNotMergeableException)) )
/app/bundles/LeadBundle/Deduplicate/ContactMerger.php:98 at Mautic\LeadBundle\Deduplicate\ContactMerger -> mergeFieldData ( object(Lead), object(Lead) )
/app/bundles/LeadBundle/Model/LegacyLeadModel.php:65 at Mautic\LeadBundle\Deduplicate\ContactMerger -> merge ( object(Lead), object(Lead) )
/app/bundles/LeadBundle/Model/LeadModel.php:2759 at Mautic\LeadBundle\Model\LegacyLeadModel -> mergeLeads ( object(Lead), object(Lead), true )
/app/bundles/FormBundle/Model/SubmissionModel.php:990 at Mautic\LeadBundle\Model\LeadModel -> mergeLeads ( object(Lead), object(Lead) )
/app/bundles/FormBundle/Model/SubmissionModel.php:403 at Mautic\FormBundle\Model\SubmissionModel -> createLeadFromSubmit ( object(Form), array('email' => '[email protected]', 'points' => '3344'),