Skip to content

Conversation

@Quazz
Copy link
Contributor

@Quazz Quazz commented Sep 7, 2021

https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Newsletter/Model/Subscriber.php#L391 it expects int for its second argument.

However, https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Store/Model/Store.php#L1060 Store->getWebsiteId() can return string|int|null

Therefore we must cast the websiteId manually to int in order to avoid a type error such as this:

Cron Job gdpr_erase_entity has an error: Argument 2 passed to Magento\Newsletter\Model\Subscriber::loadBySubscriberEmail() must be of the type int, string given, called in magento2/vendor/opengento/module-gdpr/Model/Order/Delete/Processor/SubscriberDataProcessor.php on line 64

thomas-kl1 and others added 4 commits February 10, 2021 23:12
Second variable should always be int for loadBySubscriberEmail.

However, sometimes Store->getWebsiteId() returns string or null

Therefore we must cast it to int before passing it along.
@thomas-kl1 thomas-kl1 self-assigned this Sep 7, 2021
@thomas-kl1 thomas-kl1 added the bug Something isn't working label Sep 7, 2021
@thomas-kl1 thomas-kl1 added this to the Next Release milestone Sep 7, 2021
@thomas-kl1 thomas-kl1 merged commit 8533f97 into opengento:master Sep 7, 2021
@thomas-kl1
Copy link
Member

Thank you @Quazz for your contribution, it's very appreciated 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants