magento-2-social-login
magento-2-social-login copied to clipboard
Not compatible with PHP 8
Preconditions
- Magento: 2.4.4
- PHP: 8
Steps to reproduce
- Attempt to install the module in a Magento 2.4.4 instance
Expected result
- Module is installed
Actual result
- Module cannot be installed, due to
hybridauth
version requirement:
- facebook/graph-sdk[5.4.0, ..., 5.7.0] require php ^5.4|^7.0 -> your php version (8.0.7) does not satisfy that requirement.
- mageplaza/magento-2-social-login[4.1.0, ..., 4.1.3] require hybridauth/hybridauth ^2.14.0 -> satisfiable by hybridauth/hybridauth[v2.14.0, ..., v2.18.0].
- hybridauth/hybridauth[v2.14.0, ..., v2.18.0] require facebook/graph-sdk ^5.4 -> satisfiable by facebook/graph-sdk[5.4.0, ..., 5.7.0].
- Root composer.json requires mageplaza/magento-2-social-login ^4.1 -> satisfiable by mageplaza/magento-2-social-login[4.1.0, 4.1.1, 4.1.2, 4.1.3].
Magento 2.4.4 requires PHP 8, and support for this was added to the hybridauth
package in version 3.7
I'm also receiving this error when doing bin/magento setup:di:compile
Deprecated Functionality: Optional parameter $client_id declared before required parameter $helperData is implicitly treated as a required
parameter in /home/******/public_html/vendor/mageplaza/magento-2-social-login/Model/Providers/Oauth/OAuth2Client.php on line 85
Why does this plugin still use hybridauth 2.x instead of the latest 3.x line? Version 3.8.0 was released a few days ago and has updates for PHP 8.
same here, any update or temporally fix?
I'm also receiving this error when doing bin/magento setup:di:compile
Deprecated Functionality: Optional parameter $client_id declared before required parameter $helperData is implicitly treated as a required parameter in /home/******/public_html/vendor/mageplaza/magento-2-social-login/Model/Providers/Oauth/OAuth2Client.php on line 85
Why does this plugin still use hybridauth 2.x instead of the latest 3.x line? Version 3.8.0 was released a few days ago and has updates for PHP 8.
Hii i think i find solution please go to that file and make some change like me
public function __construct(
HelperData $helperData,
$client_id = false,
$client_secret = false,
$redirect_uri = '',
$compressed = false
) {
$this->_helperData = $helperData;
$this->client_id = $client_id;
$this->client_secret = $client_secret;
$this->redirect_uri = $redirect_uri;
$this->curl_compressed = $compressed;
}
```
you will not receive any error
you have put HelperData $helperData, before client_id and error is now gone
@Smpatidar thank you for that! 😃
That seemed to fix it for me, I was able to run the required commands (bin/magento setup:di:compile) and it went through without any problems. All seems to be good. Much appreciate the quick fix!
@FadedOut Are you able to install this on php8 with Magento 2.4.4?
@ankurRadicle sorry just saw this. Yes, with the fix that @Smpatidar posted above it installs. Also, this module was updated (v4.1.4) officially for PHP 8.x and Magento 2.4.4 a week or so ago.
@FadedOut For us, it is not getting install. V4.1.4 is still using "hybridauth/hybridauth": "^2.14.0" which is not compatible with PHP8.1
@ankurRadicle It seems you are correct. I just investigated and found that I don't have hybridauth installed - somehow. Must have happened when I upgraded to 2.4.4 from 2.4.3-p1 - I removed all modules during upgrade because I was having issues trying to upgrade. When I readded my modules I must have missed this one and somehow social-login still got installed. I have it in my admin panel (under the store settings)
But I receive this after trying to login.
I assumed it was because I currently don't have my site on google search so I couldn't authenticate the oauth authorization. But maybe it's not idk. I tried to install the hybridauth now and it is being a pain and won't install (2.14.0 isn't complaining about php version it just does nothing when I try 'composer require hybridauth/hybridauth' & v3.8.0 complains about social-login not being compatible - bleh)
At the end of the day the fact that mageplaza decides not to update their social-login to use a newer version of hybridauth (or the fact they use the garbage hybridauth to begin with - it's updated once a year or less and it's still outdated really) makes me not care so much. In the future I will be buying a paid social login that is updated and of better quality (+ works) and not dealing with this free garbage. Usuaully free is a mistake to use. In this case, it is.
Good luck on your end and sorry I couldn't be of more help.
Note!!! Risky behavior! You'll have to monitor closely moving forward if you make this change!
You can force this to install with composer require mageplaza/magento-2-social-login --ignore-platform-reqs
. However this will pull in the crappy hybridauth
and non-PHP8 FB graph-SQ
L issues.
This also installs mageplaza/magento-2-two-factor-authentication
, which needs patching (see https://github.com/mageplaza/magento-2-two-factor-authentication/issues/19). Then Social Login will work (and you'll regain access to the Admin pages).
Hopefully this will be resolved in the near future. PHP8 installs are more common now.
Removing the hybridauth/hybridauth
line from composer.json
(to get rid of the outdated hybridauth version) and running composer update
will update the Social Login extension, with a new version of HybridAuth.
It also removes Mageplaza/TwoFactorAuthentication, and Mageplaza/GoogleRecaptcha, which then throws the following error upon magento setup:upgrade
In ClassReader.php line 34:
Class "Mageplaza\GoogleRecaptcha\Console\Adminhtml\Command\Enable" does not exist
Hi @aligent-lturner,
I'm Justin from Mageplaza. Thank you for your interest in our SocialLogin module and for bringing this issue to us. Feedback like this helps us constantly improve this extension and the customer experience by knowing what we're doing right and what we can do. So I appreciate you taking the time to send us this helpful answer. We have released version 4.1.7 compatiable with PHP 8 Again, thanks for your important contribution here. Our gratitude has no limits.
Hi @aligent-lturner,
I'm Justin from Mageplaza. Thank you for your interest in our SocialLogin module and for bringing this issue to us. Feedback like this helps us constantly improve this extension and the customer experience by knowing what we're doing right and what we can do. So I appreciate you taking the time to send us this helpful answer. We have released version 4.1.7 compatiable with PHP 8 Again, thanks for your important contribution here. Our gratitude has no limits.
Thank you for looking into this. But unfortunately, 4.1.7 is still not completely compatible with PHP 8. Not sure what you were testing but I'm using PHP 8.1 and receive errors about "string" and "Passing null to parameter". Which is a PHP 8.x compatibility problem.
Here is the error received when I try to log in using something like a Google account:
Ooophs, we got an error: Deprecated Functionality: trim(): Passing null to parameter #1 ($string) of type string is deprecated in ./public_html/vendor/mageplaza/magento-2-social-login/Helper/Social.php on line 136
To make it work (temporarily and probably not the correct way) you have to put (string) between the ( and $ on lines 136, 148 and 160. They should look like this:
trim((string)$this->getConfigValue
Then the error goes away. I've seen this (and done this) with other modules not compatible with PHP 8.
Oh a [positive] sidenote, it is MUCH appreciated that you guys finally updated to HybridAuth 3. The login (with the fix above) seems to be working great now👍, thanks for that! And thanks for implementing the data deletion function as that seems to be a requirement with Google.
Thanks for your contribution. We will check on the error you are experiencing and update it. Thank you very much!