Conversation
Change: In Magento\Framework\ObjectManager\Config\Config::_mergeConfiguration(), replace array_replace with array_replace_recursive so array arguments are merged instead of overwritten across areas.
|
Hi @Genaker. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
|
The security team has been informed about this pull request due to the presence of risky security keywords. For security vulnerability reports, please visit Adobe's vulnerability disclosure program on HackerOne or email psirt@adobe.com. |
|
@magento run all tests |
Change: In Magento\Framework\ObjectManager\Config\Config::_mergeConfiguration(), replace array_replace with array_replace_recursive so array arguments are merged instead of overwritten across areas
Description (*)
In
Magento\Framework\ObjectManager\Config\Config::_mergeConfiguration(), array arguments are merged usingarray_replace(). When a type is configured in globaletc/di.xmlwith array arguments (e.g.collections), and the same type is modified in area-specificetc/adminhtml/di.xml(e.g. adding a plugin or more arguments), the entire array value is replaced instead of merged. Global entries are lost, causing "Not registered handle" errors on admin grids (e.g. CMS Blocks, Pages).Change: Replace
array_replacewitharray_replace_recursiveso nested array arguments are merged by key. This preserves both global and area-specific items.File:
ObjectManager/Config/Config.php(line ~261)Fixed Issues (if relevant)
Bug in DI generation: array arguments got replaced instead of merging when modified from different area #34464
Manual testing scenarios (*)
etc/di.xmladding acollectionsitem toMagento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory.etc/adminhtml/di.xmlin the same module with a plugin onCollectionFactoryand an additionalcollectionsitem.CollectionFactory::getReport('cms_block_listing_data_source')succeeds (no "Not registered handle" exception).Questions or comments
array_replace_recursivepreserves existing behavior when no nested keys overlap. When keys overlap, the second value wins (same asarray_replacefor that key), but sibling keys are now merged instead of lost.