Skip to content

Unable to Plugin to \Magento\TwoFactorAuth\Observer\ControllerActionPredispatch #296

Closed
@NathanDayFE

Description

@NathanDayFE

Preconditions (*)

  1. Magento 2.4

Steps to reproduce (*)

  1. Attempt to plugin to \Magento\TwoFactorAuth\Observer\ControllerActionPredispatch::execute will not work due to \Magento\TwoFactorAuth\TestFramework\ControllerActionPredispatch being a preference of it
  2. Attempt to plugin to \Magento\TwoFactorAuth\TestFramework\ControllerActionPredispatch will work in dev mode as interceptors are generated on the fly
  3. Switch to production mode and run setup:di:compile
  4. No interceptor is generated for \Magento\TwoFactorAuth\TestFramework\ControllerActionPredispatch becuase it has <VENDOR_MODULE>/Test in its filepath (excluded in \Magento\Setup\Module\Di\Code\Reader\ClassesScanner::extract)

Expected result (*)

  1. should be able to plugin to \Magento\TwoFactorAuth\Observer\ControllerActionPredispatch::execute

Actual result (*)

  1. Unable to plugin to method due to preference

Suggested solution

  • Migrate the \Magento\TwoFactorAuth\TestFramework\ControllerActionPredispatch preference to be a plugin keeping the \Magento\TwoFactorAuth\Observer\ControllerActionPredispatch interceptor in play

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions