Description
Preconditions and environment
- Magento version 2.4.3 and all higher versions (currently up to 2.4.7-beta2)
- WYSIWYG state doesn't play affect this issue. Issue can be reproduced with disabled WYSIWYG editor
- In case Adobe Commerce is used for testing, then please disable Page Builder (PB) for CMS (depends on M2 version there are different ways to do that, but for 2.4.7-beta2 please navigate to Stores => Configuration => General => Content Management => Advanced Content Toots => Enable Page Builder). With enabled Page Builder only few test cases are valid. Other can be not reproduced as WYSIWYG completely replaced by PB.
- Add custom WYSIWYG variable to variable pool, but use system config field from the config group, which contains fields with 'depends' XML node. In system.xml that field should be in the same group with at least 1 field with 'depends' node, which goes before the field, which we want to add as a variable. Our field for variable doesn't require 'depends' node (no dependencies are needed here). In my case it was variable from RMA module, but that module is not present in Open Source Magento. I prepared another snippet, which is valid for Open Source Edition
<type name="Magento\Variable\Model\Config\Structure\AvailableVariables">
<arguments>
<argument name="configPaths" xsi:type="array">
<item name="wishlist/wishlist_link" xsi:type="array">
<item name="wishlist/wishlist_link/use_qty" xsi:type="string">1</item>
</item>
</argument>
</arguments>
</type>
Snippet must be added to di.xml
in the global area.
Steps to reproduce
Example 1
- Add snippet from the preconditions to di.xml from the global area.
- Flush caches. Recompile DI.
- Navigate to Admin Panel => Content => Pages
- Open any existing CMS page (or press a button to create a new ones)
- Unhandled exception is shown
Example 2
- Add snippet from the preconditions to di.xml from the global area.
- Flush caches. Recompile DI.
- Navigate to Admin Panel => Content => Blocks
- Open any existing CMS block (or press a button to create a new ones)
- Unhandled exception is shown
Example 3
- Add snippet from the preconditions to di.xml from the global area.
- Flush caches. Recompile DI.
- Navigate to Admin Panel => Marketing => Email Templates
- Open any existing email template (or press a button to create a new ones)
- Unhandled exception is shown
Example 4
- Add snippet from the preconditions to di.xml from the global area.
- Flush caches. Recompile DI.
- Navigate to Admin Panel => Catalog => Products
- Open any product (or try to create a new ones), which has an attribute with WYSIWYG editor (like description) added to at least one attribute group of its attribute set
- Unhandled exception is shown
Example 5
- Add snippet from the preconditions to di.xml from the global area.
- Flush caches. Recompile DI.
- Verify that category entity has at least one WYSIWYG attribute
- Navigate to Admin Panel => Catalog => Categories
- Unhandled exception is shown
Example 6 (for Adobe Commerce with Page Builder)
- Add snippet from the preconditions to di.xml from the global area.
- Flush caches. Recompile DI.
- Navigate to Admin Panel => Content => Templates
- Unhandled exception is shown
Expected result
General expected result from upgrading Magento 2.4.2 with custom variables to any Magento 2 starting from 2.4.3 and up to 2.4.7-beta2 would be not crashed Admin Panel pages, which have WYSIWYG editor.
Expected results for given examples.
Example 1
CMS page is rendered without exceptions.
Example 2
CMS block is rendered without exceptions.
Example 3
Transactional email template is rendered without exceptions.
Example 4
Product form is rendered without exceptions.
Example 5
Category management page is rendered without exceptions.
Example 6 for Adobe Commerce with Page Builder (PB)
PB templates page is rendered without exceptions.
Actual result
General actual result from upgrading Magento 2.4.2 with custom variables to any Magento 2 starting from 2.4.3 and up to 2.4.7-beta2 are crashed Admin Panel pages, which have WYSIWYG editor.
Actual results for given examples.
Example 1
CMS page is crashed by exception.
Example 2
CMS block is crashed by exception.
Example 3
Transactional email template is crashed by exception.
Example 4
Product form is crashed by exception.
Example 5
Category management page is crashed by exception.
Example 6 for Adobe Commerce with Page Builder (PB)
PB templates page is crashed by exception.
Additional information
It seems starting from Magento 2.4.3 new way of loading config variables has been introduced. In order to improve performance now config is loaded partially, but not fully.
Node depends is added with value null
to the partially loaded config in \Magento\Config\Model\Config\Structure\Mapper\Dependencies

As a solution node depends
could be filtered from the light version of the config in \Magento\Variable\Model\Config\Structure\Dom
Current version of the code is
/**
* @inheritdoc
*/
protected function _initDom($xml)
{
$dom = parent::_initDom($xml);
foreach (['tab', 'section', 'group', 'field'] as $element) {
$this->filterElements($dom, $element, $this->getElementFilters($element));
}
return $dom;
}
It could be replaced with the following code in order to prevent issues with WYSIWYG
/**
* @inheritdoc
*/
protected function _initDom($xml)
{
$dom = parent::_initDom($xml);
foreach (['tab', 'section', 'group', 'field', 'depends'] as $element) {
$this->filterElements($dom, $element, $this->getElementFilters($element));
}
return $dom;
}
Backtrace in all cases is similar
1 exception(s):
Exception #0 (Magento\Framework\Exception\RuntimeException): Type Error occurred when creating object: Magento\Ui\Component\Form\Element\Wysiwyg, array_key_exists(): Argument #2 ($array) must be of type array, null given
Exception #0 (Magento\Framework\Exception\RuntimeException): Type Error occurred when creating object: Magento\Ui\Component\Form\Element\Wysiwyg, array_key_exists(): Argument #2 ($array) must be of type array, null given
<pre>#1 Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:56]
#2 Magento\Framework\ObjectManager\ObjectManager->create() called at [vendor/magento/framework/View/Element/UiComponentFactory.php:261]
#3 Magento\Framework\View\Element\UiComponentFactory->create() called at [vendor/magento/module-ui/Component/Form/Field.php:85]
#4 Magento\Ui\Component\Form\Field->prepare() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:164]
#5 Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:161]
#6 Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:161]
#7 Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:161]
#8 Magento\Framework\View\Layout\Generator\UiComponent->prepareComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:142]
#9 Magento\Framework\View\Layout\Generator\UiComponent->generateComponent() called at [vendor/magento/framework/View/Layout/Generator/UiComponent.php:103]
#10 Magento\Framework\View\Layout\Generator\UiComponent->process() called at [vendor/magento/framework/View/Layout/GeneratorPool.php:93]
#11 Magento\Framework\View\Layout\GeneratorPool->process() called at [vendor/magento/framework/View/Layout.php:365]
#12 Magento\Framework\View\Layout->generateElements() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:155]
#13 Magento\Framework\View\Layout\Interceptor->generateElements() called at [vendor/magento/framework/View/Layout/Builder.php:129]
#14 Magento\Framework\View\Layout\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Page/Builder.php:65]
#15 Magento\Framework\View\Page\Builder->generateLayoutBlocks() called at [vendor/magento/framework/View/Layout/Builder.php:65]
#16 Magento\Framework\View\Layout\Builder->build() called at [vendor/magento/framework/View/Layout.php:271]
#17 Magento\Framework\View\Layout->build() called at [vendor/magento/framework/View/Layout.php:896]
#18 Magento\Framework\View\Layout->getBlock() called at [vendor/magento/module-backend/Model/View/Result/Page.php:26]
#19 Magento\Backend\Model\View\Result\Page->setActiveMenu() called at [vendor/magento/module-catalog/Controller/Adminhtml/Product/Edit.php:82]
#20 Magento\Catalog\Controller\Adminhtml\Product\Edit->execute() called at [generated/code/Magento/Catalog/Controller/Adminhtml/Product/Edit/Interceptor.php:171]
#21 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->execute() called at [vendor/magento/framework/App/Action/Action.php:111]
#22 Magento\Framework\App\Action\Action->dispatch() called at [vendor/magento/module-backend/App/AbstractAction.php:151]
#23 Magento\Backend\App\AbstractAction->dispatch() called at [generated/code/Magento/Catalog/Controller/Adminhtml/Product/Edit/Interceptor.php:231]
#24 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->Magento\Catalog\Controller\Adminhtml\Product\Edit\{closure}() called at [vendor/magento/module-backend/App/Action/Plugin/Authentication.php:145]
#25 Magento\Backend\App\Action\Plugin\Authentication->aroundDispatch() called at [generated/code/Magento/Catalog/Controller/Adminhtml/Product/Edit/Interceptor.php:232]
#26 Magento\Catalog\Controller\Adminhtml\Product\Edit\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:245]
#27 Magento\Framework\App\FrontController->getActionResponse() called at [vendor/magento/framework/App/FrontController.php:212]
#28 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:147]
#29 Magento\Framework\App\FrontController->dispatch() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:153]
#30 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:116]
#31 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:57]
#32 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#33 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:30]
</pre>
Release note
Fixed crashing of Admin Panel pages, which contain WYSIWYG editor, when custom variable from the config group with dependencies is added to variable pool.
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.