magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.5k stars 9.3k forks source link

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

Open pmzandbergen opened 3 months ago

pmzandbergen commented 3 months ago

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.

m2-assistant[bot] commented 3 months ago

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:

engcom-Hotel commented 3 months ago

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

m2-assistant[bot] commented 3 months ago

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:

thecodecook14 commented 3 months ago

@magento I am working on this

github-jira-sync-bot commented 3 months ago

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

m2-assistant[bot] commented 3 months ago

: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.

pmzandbergen commented 3 months ago

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?

github-jira-sync-bot commented 3 months ago

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

hostep commented 3 months ago

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/

pmzandbergen commented 3 months ago

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