magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Object Manager not used for Magento\Csp\Model\Mode\Data\ModeConfigured

Open pmzandbergen opened this issue 1 year ago • 9 comments

File https://github.com/magento/magento2/blob/ef81f5a2f8271ea529606fcb56898eed286d46b5/app/code/Magento/Csp/Model/Mode/ConfigManager.php#L121

Description The Object Manager is not being used when creating Magento\Csp\Model\Mode\Data\ModeConfigured. Therefore Plugins can't be used on this object.

pmzandbergen avatar Jun 25 '24 17:06 pmzandbergen

Hi @pmzandbergen. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

m2-assistant[bot] avatar Jun 25 '24 17:06 m2-assistant[bot]

Hello @pmzandbergen,

Thanks for the report and collaboration!

I agree with your point, in the provided code from app/code/Magento/Csp/Model/Mode/ConfigManager.php, the Magento\Csp\Model\Mode\Data\ModeConfigured object is being instantiated directly using the new keyword.

When an object is created directly like this, Magento's Object Manager is bypassed, which means that any plugins (interceptors) that might be defined for that class will not be triggered.

Hence confirming the issue.

Thanks

engcom-Hotel avatar Jun 26 '24 07:06 engcom-Hotel

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • [ ] 5. Add label Issue: Confirmed once verification is complete.
  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Jun 26 '24 07:06 m2-assistant[bot]

@magento I am working on this

thecodecook14 avatar Jun 26 '24 07:06 thecodecook14

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12299 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Jun 26 '24 07:06 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Jun 26 '24 07:06 m2-assistant[bot]

Hello @pmzandbergen,

Thanks for the report and collaboration!

I agree with your point, in the provided code from app/code/Magento/Csp/Model/Mode/ConfigManager.php, the Magento\Csp\Model\Mode\Data\ModeConfigured object is being instantiated directly using the new keyword.

When an object is created directly like this, Magento's Object Manager is bypassed, which means that any plugins (interceptors) that might be defined for that class will not be triggered.

Hence confirming the issue.

Thanks

Shall I create a PR with the required changes, or is @thecodecook14 working on this?

pmzandbergen avatar Jun 26 '24 07:06 pmzandbergen

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-12299

github-jira-sync-bot avatar Jun 26 '24 08:06 github-jira-sync-bot

Shall I create a PR with the required changes ...

Looks like @glo24157 started working on it on this branch: https://github.com/magento/magento2/commits/issue38875/

hostep avatar Jun 26 '24 20:06 hostep

PR is ready for review: https://github.com/magento/magento2/pull/38886

pmzandbergen avatar Jul 03 '24 08:07 pmzandbergen