dotmailer / dotmailer-magento2-extension

The official Dotdigital for Magento2 extension
https://dotdigital.com/integrations/magento
MIT License
48 stars 63 forks source link

Unable to apply data patch Dotdigitalgroup\Email\Setup\Patch\Data\MigrateData #599

Closed deemantha22 closed 1 year ago

deemantha22 commented 1 year ago

hi,

Need advice please.

I am getting below issue on M2.4.5p1/ php 8.1/ mysql 8

Unable to apply data patch Dotdigitalgroup\Email\Setup\Patch\Data\MigrateData for module Dotdigitalgroup_Email. Original exception message: Deprecated Functionality: strcasecmp(): Passing null to parameter #2 ($string2) of type string is deprecated in /m..../vendor/dotdigital/dotdigital-magento2-extension/Setup/Install/Type/InsertEmailOrderTable.php on line 155

sta1r commented 1 year ago

@deemantha22 am I right in saying you already have a support ticket submitted for this? If so, let's resolve via that route.

deemantha22 commented 1 year ago

@sta1r sorry, I don't have a ticket submitted for this.

sta1r commented 1 year ago

No worries - we literally had the exact same issue submitted about 12hrs ago. In any case I will respond here in case anyone else has the same problem.

https://github.com/dotmailer/dotmailer-magento2-extension/blob/master/Setup/Install/Type/InsertEmailOrderTable.php#L155

In this case we have a set of emails that we are intending to add as guests to our email_contact table, but one or more of them is null. Can you investigate to see how big of an issue this is on your side i.e. check for empty customer_email in sales_order? To my knowledge it should not be possible for orders to be completed in Magento without an email. If you were to remove these, the migration should complete.

So, we can tighten this up from our side (not migrate any orders where customer_email is null) but it feels like an anomaly from your side at the same time.

deemantha22 commented 1 year ago

Maybe it's something todo with latest magento. I may be wrong. Not having empty emails in sales_order

I am middle of debugging and so far no luck. "name": "dotdigital/dotdigital-magento2-extension", "version": "4.19.5",

when I do setup:upgrade it get stuck with below.

Module 'Algolia_AlgoliaSearch': Module 'Dotdigitalgroup_Email':

Found out that database stuck with '_104 root localhost m2_nws_dm Query 82 Sending data INSERT INTO email_contact (email, customer_id, is_subscriber, subscriber_status, `storeid'

sta1r commented 1 year ago

The only way I can replicate the error you are seeing (related to strcasecmp) is if one or more values in $guestOrderEmails is null.

Please can you confirm this query returns no results in your db?

select entity_id from sales_order where customer_email IS NULL;

If it does return results, you probably want to remove those rows and retry.

If it doesn't, you can do the following:

If you still have issues, I can also suggest adding:

$guestOrderEmails = array_filter($guestOrderEmails);
$matchingContactEmails = array_filter($matchingContactEmails);

above L155 in Setup/Install/Type/InsertEmailOrderTable.php.

deemantha22 commented 1 year ago

@sta1r thanks for getting back to me. Removing records with empty sales customer_emails fixed the problem. Not sure how the random records got created.

All sorted. thanks