Warning: Illegal offset type in vendor/magento/framework/App/Config/ScopeCodeResolver.php on line 58
Judging by code the class of ScopeCodeResolver can work with the objects ScopeInterface as a second parameter of the resolve method but it will cause 'Illegal offset type' warning.
Preconditions
- Magento v. 2.1.4
Steps to reproduce
` /** @var \Magento\Store\Model\Store $store */ $store = $this->_objectManager->get('Magento\Store\Model\Store'); $store->load(0);
$resolver = $this->_objectManager->get('Magento\Framework\App\Config\ScopeCodeResolver'); $code = $resolver->resolve('store', $store);
echo $code; `
Expected result
- The method has to return store code.
Actual result
Exception #0 (Exception): Warning: Illegal offset type in vendor/magento/framework/App/Config/ScopeCodeResolver.php on line 59
#1 Magento\Framework\App\Config\ScopeCodeResolver->resolve('store', Object(Magento\Store\Model\Store\Interceptor))
Same Issue
Same Issue
same here, i got this error while creating orders that we received in M2E pro.
@michafn, me too. In order to fix that you can make some modifications to app\code\Ess\M2ePro\Model\Magento\Quote\Store\Configurator.php
find the methods setStoreConfig() and getStoreConfig() and replace $this->getStore() with $this->getStore()->getCode() for theirs arguments
@raisaev : thank you very much for this fix
Nice Raisaev. It works !!! You must have great experience in Magento code $this->storeConfig->setValue($key, $value, \Magento\Store\Model\ScopeInterface::SCOPE_STORE, $this->getStore()->getCode());
some modifications to app\code\Ess\M2ePro\Model\Magento\Quote\Store\Configurator.php
This piece of code in Magento never worked or was changed recently?
We had this issue come up as well as soon as we updated to the latest M2E Pro version. M2E Pro gave us a new Configurator.php file and it solved the issue... it basically just had the fix mentioned above.
Also get this error creating orders in M2E Pro. @raisaev fix works, so is this an M2E issue or a Magento issue? Also an upgrade of M2E will override Configurator.php modifications, so watch out for that.
@raisaev, thank you for your report. We've created internal ticket(s) MAGETWO-80961 to track progress on the issue.
Steps to reproduce are invalid, $store model obviously cannot be passed to \Magento\Framework\App\Config\ScopeCodeResolver::resolve:
/**
* Resolve scope code
*
* @param string $scopeType
* @param string $scopeCode
* @return string
*/
public function resolve($scopeType, $scopeCode)
Other issues mentioned in discussion are bugs in third-party code which seem to be already fixed. Thanks for collaboration and help in sorting this out!