mautic-extended-field icon indicating copy to clipboard operation
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.

Open WaldemarOrobanche opened this issue 4 years ago • 0 comments

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

  1. Create an extended custom field, for example: my_extended_field;
  2. 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
  3. Create a contact with filled an email only.
  4. Put your form to a website.
  5. Go to your website page with your form like an anonymous and try to submit the form.

image

  1. 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'),

WaldemarOrobanche avatar Jun 25 '20 13:06 WaldemarOrobanche