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

Config Path leads to site wide Exception "A non well formed numeric value encountered" #1223

Closed
KM-HM opened this issue Jun 22, 2021 · 4 comments
Assignees

Comments

@KM-HM
Copy link

KM-HM commented Jun 22, 2021

Issue Description

A config path stored in the Magento database table "core_config_data" leads to exception on admin and storefront right after cron job was run.

Preconditions

1. Magento CE 2.4.2-p1 
2. mailchimp/mc-magento2 version 103.4.43
3. Single Store, **no** single store mode
4. Existing Mail Chimp store with an id like "0daabac359722e58dba99ba5ba720bb3"

Steps to reproduce

1. In Magento Admin go to "Stores -> Configuration --> MailChimp -> Mailchimp" 
2. In the "Mailchimp General Configuration" section set the option "Mailchimp Store" to be the existing mail chimp store 
3. Click "Save" to save the configuration
4. Make sure the cron job "ebizmarts_ecommerce" is run either by running it manually or just install Magento cron job as 
per Magento documentation

Actual and Expected result

Expected result:
Magento executes without error 
Actual result:
An exception is thrown on admin and storefront
Exception:
Notice: A non well formed numeric value encountered in 
[Magento_root_direcotry]/vendor/magento/framework/App/Config/Scope/Converter.php on line 41

in [Magento_root_direcotry]/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: 

#0 [Magento_root_direcotry]/vendor/magento/framework/App/Config/Scope/Converter.php(41): Magento\Framework\App\ErrorHandler->handler() 
#1 [Magento_root_direcotry]/vendor/magento/framework/App/Config/Scope/Converter.php(22): Magento\Framework\App\Config\Scope\Converter->_setArrayValue() 
#2 [Magento_root_direcotry]/vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php(108): Magento\Framework\App\Config\Scope\Converter->convert() 
#3 [Magento_root_direcotry]/vendor/magento/module-config/App/Config/Source/RuntimeConfigSource.php(72): Magento\Config\App\Config\Source\RuntimeConfigSource->loadConfig() 
#4 [Magento_root_direcotry]/vendor/magento/framework/App/Config/ConfigSourceAggregated.php(42): Magento\Config\App\Config\Source\RuntimeConfigSource->get() 
#5 [Magento_root_direcotry]/vendor/magento/module-config/App/Config/Type/System/Reader.php(60): Magento\Framework\App\Config\ConfigSourceAggregated->get() 
#6 [Magento_root_direcotry]/generated/code/Magento/Config/App/Config/Type/System/Reader/Proxy.php(95): Magento\Config\App\Config\Type\System\Reader->read() 
#7 [Magento_root_direcotry]/vendor/magento/module-config/App/Config/Type/System.php(395): Magento\Config\App\Config\Type\System\Reader\Proxy->read() 
#8 [Magento_root_direcotry]/vendor/magento/framework/Cache/LockGuardedCacheLoader.php(136): Magento\Config\App\Config\Type\System->readData() 
#9 [Magento_root_direcotry]/vendor/magento/module-config/App/Config/Type/System.php(281): Magento\Framework\Cache\LockGuardedCacheLoader->lockedLoadData() 
#10 [Magento_root_direcotry]/vendor/magento/module-config/App/Config/Type/System.php(207): Magento\Config\App\Config\Type\System->loadDefaultScopeData() 
#11 [Magento_root_direcotry]/vendor/magento/module-config/App/Config/Type/System.php(181): Magento\Config\App\Config\Type\System->getWithParts() 
#12 [Magento_root_direcotry]/vendor/magento/framework/App/Config.php(132): Magento\Config\App\Config\Type\System->get() 
#13 [Magento_root_direcotry]/vendor/magento/framework/App/Config.php(80): Magento\Framework\App\Config->get() 
#14 [Magento_root_direcotry]/vendor/magento/framework/App/Config.php(93): Magento\Framework\App\Config->getValue() 
#15 [Magento_root_direcotry]/vendor/magento/module-store/Model/HeaderProvider/Hsts.php(50): Magento\Framework\App\Config->isSetFlag() 
#16 [Magento_root_direcotry]/vendor/magento/framework/App/Response/HeaderManager.php(42): Magento\Store\Model\HeaderProvider\Hsts->canApply() 
#17 [Magento_root_direcotry]/vendor/magento/framework/Interception/Interceptor.php(121): Magento\Framework\App\Response\HeaderManager->beforeSendResponse() 
#18 [Magento_root_direcotry]/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\Response\Http\Interceptor->Magento\Framework\Interception\{closure}() 
#19 [Magento_root_direcotry]/generated/code/Magento/Framework/App/Response/Http/Interceptor.php(23): Magento\Framework\App\Response\Http\Interceptor->___callPlugins() 
#20 [Magento_root_direcotry]/vendor/magento/framework/App/ExceptionHandler.php(103): Magento\Framework\App\Response\Http\Interceptor->sendResponse() 
#21 [Magento_root_direcotry]/vendor/magento/framework/App/ExceptionHandler.php(70): Magento\Framework\App\ExceptionHandler->handleDeveloperMode() 
#22 [Magento_root_direcotry]/vendor/magento/framework/App/Http.php(156): Magento\Framework\App\ExceptionHandler->handle() 
#23 [Magento_root_direcotry]/vendor/magento/framework/App/Bootstrap.php(269): Magento\Framework\App\Http->catchException() 
#24 [Magento_root_direcotry]/pub/index.php(29): Magento\Framework\App\Bootstrap->run() 
#25 {main} 

Additional information

When the cron job named
"ebizmarts_ecommerce"
is run this method will be called
"Ebizmarts\MailChimp\Cron\Ecommerce::execute".

The method will look up the path
"mailchimp/general/monkeystore" from "core_config_data" table and use it's value to create a new entry inside core_config_data table.

That creates a config path like
"mailchimp/general/issync/[mailchimp_general_monkeystore_value]"
or as an example "mailchimp/general/issync/0daabac359722e58dba99ba5ba720bb3"
this however will lead to the exception above the next time Magento loads because /vendor/magento/framework/App/Config/Scope/Converter.php can not work with this path.

@gonzaloebiz gonzaloebiz self-assigned this Jun 22, 2021
@gonzaloebiz
Copy link
Collaborator

Hi @kemexyz

i just try with Magento ver. 2.4.2-p1 version and Mailchimp v103.4.43 and work OK for me.
Modified the file vendor/magento/framework/App/Config/Scope/Converter.php and change the function

    protected function _setArrayValue(array &$container, $path, $value)
    {
        error_log($path."\n",3,BP."/var/log/issue1223.log");
        $segments = explode('/', $path);
        $currentPointer = & $container;
        foreach ($segments as $segment) {
            if (!isset($currentPointer[$segment])) {
                $currentPointer[$segment] = [];
            }
            $currentPointer = & $currentPointer[$segment];
        }
        $currentPointer = $value;
        error_log($currentPointer."\n",3,BP."/var/log/issue1223.log");
    }

to see if the function fails and loads OK the path like mailchimp/general/issync/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

What version of PHP are you using?

@KM-HM
Copy link
Author

KM-HM commented Jun 24, 2021

Hi @gonzaloebiz,

thanks for checking. I have had this issue on PHP 7.3 with Magento 2.3 as well ass PHP 7.3 with Magento 2.4 (I just noticed I'm running the update on the wrong PHP Version, not really relevant as I had this with Magento 2.3.5 PHP7.3 as well).

I will check if there is any other setting that deviates from default.

@gonzaloebiz
Copy link
Collaborator

Perhaps if you can send me a ticket to our support email with all your magento configuration I can help you, I think some special store configuration is affecting you.

Best

@gonzaloebiz
Copy link
Collaborator

Closes the issue until have news

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants