Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning: Illegal offset type in vendor/magento/framework/App/Config/ScopeCodeResolver.php on line 58 #8530

Closed
raisaev opened this issue Feb 13, 2017 · 11 comments
Assignees
Labels
Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development non-issue

Comments

@raisaev
Copy link

raisaev commented Feb 13, 2017

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

  1. 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

  1. 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))

@anethum
Copy link

anethum commented Feb 13, 2017

Same Issue

1 similar comment
@bobsimage
Copy link

Same Issue

@michafn
Copy link

michafn commented Feb 21, 2017

same here, i got this error while creating orders that we received in M2E pro.

@raisaev
Copy link
Author

raisaev commented Feb 22, 2017

@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

@michafn
Copy link

michafn commented Feb 22, 2017

@raisaev : thank you very much for this fix

@lakehavasu
Copy link

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());

@orlangur
Copy link
Contributor

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?

@EmilyPepperman
Copy link
Contributor

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.

@dunarri
Copy link

dunarri commented Mar 11, 2017

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.

@magento-engcom-team magento-engcom-team added G1 Passed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed and removed G1 Passed labels Sep 5, 2017
@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Oct 5, 2017
@magento-engcom-team magento-engcom-team self-assigned this Oct 5, 2017
@magento-engcom-team
Copy link
Contributor

@raisaev, thank you for your report.
We've created internal ticket(s) MAGETWO-80961 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 5, 2017
@orlangur
Copy link
Contributor

orlangur commented Oct 5, 2017

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!

@orlangur orlangur closed this as completed Oct 5, 2017
@orlangur orlangur added non-issue and removed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Oct 5, 2017
magento-devops-reposync-svc pushed a commit that referenced this issue Nov 5, 2023
…elop-sync-09112023

Sync of 2.4.7-beta2-develop with 2.4-develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development non-issue
Projects
None yet
Development

No branches or pull requests

9 participants