magento-2-social-login
magento-2-social-login copied to clipboard
Magento 2.4.1 An error has happened during application run. See exception log for details.
Preconditions
- Magento: 2.4.1
- PHP: 7.4
- MySQL: 8.0
Steps to reproduce
- composer install and config smtp
Expected result
Actual result
- [Screenshot, logs]
Image showed like this system.log below:
main.CRITICAL: TypeError: Return value of Magento\Customer\Model\EmailNotification::getWebsiteStoreId() must be of the type int, string returned in /www/wwwroot/shop/vendor/magento/module-customer/Model/EmailNotification.php:311 Stack trace: #0 /www/wwwroot/shop/vendor/magento/module-customer/Model/EmailNotification.php(389): Magento\Customer\Model\EmailNotification->getWebsiteStoreId() #1 /www/wwwroot/shop/vendor/mageplaza/magento-2-social-login/Model/Social.php(233): Magento\Customer\Model\EmailNotification->newAccount() #2 /www/wwwroot/shop/vendor/mageplaza/magento-2-social-login/Controller/Social/AbstractSocial.php(194): Mageplaza\SocialLogin\Model\Social->createCustomerSocial() #3 /www/wwwroot/shop/vendor/mageplaza/magento-2-social-login/Controller/Social/AbstractSocial.php(174): Mageplaza\SocialLogin\Controller\Social\AbstractSocial->createCustomer() #4 /www/wwwroot/shop/vendor/mageplaza/magento-2-social-login/Controller/Social/Login.php(92): Mageplaza\SocialLogin\Controller\Social\AbstractSocial->createCustomerProcess() #5 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(58): Mageplaza\SocialLogin\Controller\Social\Login->execute() #6 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(138): Mageplaza\SocialLogin\Controller\Social\Login\Interceptor->___callParent() #7 /www/wwwroot/shop/vendor/magento/framework/App/Action/Plugin/ActionFlagNoDispatchPlugin.php(51): Mageplaza\SocialLogin\Controller\Social\Login\Interceptor->Magento\Framework\Interception{closure}() #8 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Framework\App\Action\Plugin\ActionFlagNoDispatchPlugin->aroundExecute() #9 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(153): Mageplaza\SocialLogin\Controller\Social\Login\Interceptor->Magento\Framework\Interception{closure}() #10 /www/wwwroot/shop/generated/code/Mageplaza/SocialLogin/Controller/Social/Login/Interceptor.php(23): Mageplaza\SocialLogin\Controller\Social\Login\Interceptor->___callPlugins() #11 /www/wwwroot/shop/vendor/magento/framework/App/Action/Action.php(111): Mageplaza\SocialLogin\Controller\Social\Login\Interceptor->execute() #12 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\Action\Action->dispatch() #13 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(138): Mageplaza\SocialLogin\Controller\Social\Login\Interceptor->___callParent() #14 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(153): Mageplaza\SocialLogin\Controller\Social\Login\Interceptor->Magento\Framework\Interception{closure}() #15 /www/wwwroot/shop/generated/code/Mageplaza/SocialLogin/Controller/Social/Login/Interceptor.php(32): Mageplaza\SocialLogin\Controller\Social\Login\Interceptor->___callPlugins() #16 /www/wwwroot/shop/vendor/magento/framework/App/FrontController.php(186): Mageplaza\SocialLogin\Controller\Social\Login\Interceptor->dispatch() #17 /www/wwwroot/shop/vendor/magento/framework/App/FrontController.php(118): Magento\Framework\App\FrontController->processRequest() #18 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch() #19 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent() #20 /www/wwwroot/shop/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(99): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}() #21 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch() #22 /www/wwwroot/shop/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(75): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}() #23 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch() #24 /www/wwwroot/shop/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception{closure}() #25 /www/wwwroot/shop/generated/code/Magento/Framework/App/FrontController/Interceptor.php(23): Magento\Framework\App\FrontController\Interceptor->___callPlugins() #26 /www/wwwroot/shop/vendor/magento/framework/App/Http.php(116): Magento\Framework\App\FrontController\Interceptor->dispatch() #27 /www/wwwroot/shop/vendor/magento/framework/App/Bootstrap.php(263): Magento\Framework\App\Http->launch() #28 /www/wwwroot/shop/pub/index.php(40): Magento\Framework\App\Bootstrap->run() #29 {main} [] []
I'm Victor from Mageplaza. I would like to answer your question. Maybe in your database that parameter is stored as text instead of int. To make that clear, you can force it to become an int on line 209 of the file www/wwwroot/shop/vendor/mageplaza/magento-2-social-login/Model/Social.php(209)
I'm Victor from Mageplaza. I would like to answer your question. Maybe in your database that parameter is stored as text instead of int. To make that clear, you can force it to become an int on line 209 of the file www/wwwroot/shop/vendor/mageplaza/magento-2-social-login/Model/Social.php(209)
This didnt't fixed the issue at all, even if you force it there it then does
221: $customer = $this->customerRepository->save($customer);
and it goes back to string. I tryed to force it to int again before passing it to
230: if ($this->apiHelper->canSendPassword($store)) {
231: $this->getEmailNotification()->newAccount(
232: $customer,
233: EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED_NO_PASSWORD
234: );
235: }
where it breaks and still nothing.
Even though it is bad practise I had to make a change at vendor/magento/module-customer/Model/EmailNotification.php
in the
305: private function getWebsiteStoreId($customer, $defaultStoreId = null): int
like that
311: return (int)$defaultStoreId;
Any update on this? same issue on my end version 2.4.1 and 2.4.1-p1
@jeredmilla @creativedays
I checked last Magento release, and nothing changed in the core. So I added parameters to the newAccount function, l. 234 of Social.php , i think it does the trick
if ($this->apiHelper->canSendPassword($store)) {
$this->getEmailNotification()->newAccount(
$customer,
EmailNotificationInterface::NEW_ACCOUNT_EMAIL_REGISTERED_NO_PASSWORD,
'',
(int) $customer->getStoreId(),
(int) $customer->getStoreId()
);
}
public function newAccount( CustomerInterface $customer, $type = self::NEW_ACCOUNT_EMAIL_REGISTERED, $backUrl = '', $storeId = null, $sendemailStoreId = null )