Skip to content

Fix Magento bug #34464#40531

Open
Genaker wants to merge 1 commit intomagento:2.4-developfrom
Genaker:patch-8
Open

Fix Magento bug #34464#40531
Genaker wants to merge 1 commit intomagento:2.4-developfrom
Genaker:patch-8

Conversation

@Genaker
Copy link
Contributor

@Genaker Genaker commented Feb 13, 2026

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 using array_replace(). When a type is configured in global etc/di.xml with array arguments (e.g. collections), and the same type is modified in area-specific etc/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_replace with array_replace_recursive so 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

  1. Fixes Bug in DI generation: array arguments got replaced instead of merging when modified from different area #34464

Manual testing scenarios (*)

  1. Create a custom module with global etc/di.xml adding a collections item to Magento\Framework\View\Element\UiComponent\DataProvider\CollectionFactory.
  2. Add etc/adminhtml/di.xml in the same module with a plugin on CollectionFactory and an additional collections item.
  3. In admin area, verify CollectionFactory::getReport('cms_block_listing_data_source') succeeds (no "Not registered handle" exception).
  4. Open Content > Blocks and Content > Pages in admin; both grids should load without errors.
  5. Open Sales > Orders; order grid should load without errors.

Questions or comments

array_replace_recursive preserves existing behavior when no nested keys overlap. When keys overlap, the second value wins (same as array_replace for that key), but sibling keys are now merged instead of lost.

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.
@m2-assistant
Copy link

m2-assistant bot commented Feb 13, 2026

Hi @Genaker. Thank you for your contribution!
Here are some useful tips on how you can test your changes using Magento test environment.
❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names.

Allowed build names are:
  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests
  13. Semantic Version Checker

You can find more information about the builds here
ℹ️ Run only required test builds during development. Run all test builds before sending your pull request for review.


For more details, review the Code Contributions documentation.
Join Magento Community Engineering Slack and ask your questions in #github channel.

@ct-prd-pr-scan
Copy link

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.

@Genaker
Copy link
Contributor Author

Genaker commented Feb 16, 2026

@magento run all tests

@engcom-Bravo engcom-Bravo added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Feb 17, 2026
@github-project-automation github-project-automation bot moved this to Pending Review in Pull Requests Dashboard Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: pending review

Projects

Status: Pending Review

Development

Successfully merging this pull request may close these issues.

Bug in DI generation: array arguments got replaced instead of merging when modified from different area

2 participants