Skip to content

[Backport] magento/magento2#?: fix issue with di.xml config merging for classes array argument in case of different sources and the class name difference in leading slash. #20921

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

Conversation

swnsma
Copy link
Contributor

@swnsma swnsma commented Feb 3, 2019

Description (*)

See original PR #20891

Fixed Issues (if relevant)

  1. Magento\Catalog\Api\ProductRenderListInterface returns products regardless of visibility #20409
  2. Types not merged for etc/di.xml etc/adminhtml/di.xml #21193

Manual testing scenarios

Pre-Conditions

  1. Change constructor of \Magento\Cms\Controller\Index\Index and add new argument 'data' (simple way to visualize it):
public function __construct(`
`        Context $context,`
        ForwardFactory $resultForwardFactory,
        ScopeConfigInterface $scopeConfig = null,
        Page $page = null,
        array $data = []
    ) {
        var_dump($data);
        die;
    }

Steps to reproduce

  1. Create module A and B with simple config set (registration.php and module.xml).
  2. Execute in terminal php bin/magento setup:upgrade.
  3. Create etc/di.xml for module A:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Cms\Controller\Index\Index">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="p1" xsi:type="string">Hello Phrase1</item>
            </argument>
        </arguments>
    </type>
</config>
  1. Create etc/di.xml for module B:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="\Magento\Cms\Controller\Index\Index">
        <arguments>
            <argument name="data" xsi:type="array">
                <item name="p2" xsi:type="string">Hello Phrase2</item>
            </argument>
        </arguments>
    </type>
</config>
  1. Execute in terminal php bin/magento cache:flush
  2. Open home page.

Expected results

image

Actual results

image

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

…array argument in case of different sources and the class name difference in leading slash.
@magento-engcom-team
Copy link
Contributor

Hi @swnsma. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me 2.2-develop instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-engcom-team magento-engcom-team added Component: Framework/ObjectManager Release Line: 2.2 Partner: ISM eCompany Pull Request is created by partner ISM eCompany partners-contribution Pull Request is created by Magento Partner labels Feb 3, 2019
@rogyar rogyar self-assigned this Feb 23, 2019
@swnsma swnsma closed this Mar 15, 2019
@ghost
Copy link

ghost commented Mar 15, 2019

Hi @swnsma, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Framework/ObjectManager Partner: ISM eCompany Pull Request is created by partner ISM eCompany partners-contribution Pull Request is created by Magento Partner Progress: on hold Release Line: 2.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants