Skip to content

[Issue] Log undeclared plugin only if it is not disabled #40086

@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #40081: Log undeclared plugin only if it is not disabled


Description (*)

Developer may disable a plugin from module (A) with a third party module (B).
The plugin is referenced in di.xml thanks to its name and the attribute "disabled" is set to 'true'. The attribute "type" is not set.
If the module (A) is removed, and the referenced plugin in module (B) is not removed, Magento will report this as an error (info level) in the logs. This has effect to flood the logs with false positive cases.
Indeed, we should only log the plugin who are actually undeclared and not used (enabled and missing instance).

Manual testing scenarios (*)

Module A:

<type name="Magento\SalesRule\Model\Rule\Condition\Product">
    <plugin name="Foo_Bar::Conditions" type="Foo\Bar\Plugin\Condition\Product"/>
</type>

Remove the plugin declaration from module A (above declaration).

Module B (with sequence on Module A):

<type name="Magento\SalesRule\Model\Rule\Condition\Product">
    <plugin name="Foo_Bar::Conditions" disabled="true"/>
</type>

Expected: no logs.

Actual: logs entries:

[2025-07-18T12:18:49.535562+00:00] main.INFO: Reference to undeclared plugin with name 'Foo_Bar::Conditions'. [] []

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)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: P2A defect with this priority could have functionality issues which are not to expectations.

    Type

    No type

    Projects

    Status

    Ready for Development

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions