This issue is caused by the users encoded_config
and encoded_providers
being empty. Which in turn can't be unserialized which causes an empty response. The code expects an array.
To resolve this issue.
- Make sure you have:
cweagans/composer-patches
installed. If not this can be installed with composer require cweagans/composer-patches
- Add the following in your
composer.json
...
"extra": {
...
"composer-exit-on-patch-failure": true,
"patches": {
"msp/twofactorauth": {
"Empty config error": "patches/msp_mfa_no_config_error_fix.patch"
}
}
},
- make the following file:
patches/msp_mfa_no_config_error_fix.patch
--- Model/ResourceModel/UserConfig.php 2020-06-19 11:30:47.611900565 +0000
+++ Model/ResourceModel/UserConfig.php 2020-06-19 11:38:47.911245449 +0000
@@ -99,18 +99,26 @@
public function _afterLoad(AbstractModel $object)
{
parent::_afterLoad($object);
-
- try {
- $object->setData('config', $this->decodeConfig($object->getData('encoded_config') ?? ''));
- } catch (Exception $e) {
- $object->setData('config', []);
- }
-
- try {
- $object->setData('providers', $this->serializer->unserialize($object->getData('encoded_providers') ?? ''));
- } catch (Exception $e) {
- $object->setData('providers', []);
+
+ $config = [];
+ if($object->hasData('encoded_config')){
+ try{
+ $config = $this->decodeConfig($object->getData('encoded_config') ?? '');
+ } catch (Exception $e) {
+ // don't need to do anything should fall back to empty []
+ }
}
+ $object->setData('config', $config);
+
+ $providers = [];
+ if($object->hasData('encoded_providers')){
+ try {
+ $providers = $this->serializer->unserialize($object->getData('encoded_providers') ?? '');
+ } catch (Exception $e) {
+ // don't need to do anything should fall back to empty []
+ }
+ }
+ $object->setData('providers', $providers);
return $this;
}
composer update
rm -rf vendor/msp/twofactorauth
composer install --no-dev