Skip to content

Interceptor not working when calling parent::method() #11699

Closed
@milansimek

Description

@milansimek

Preconditions

Magento 2.1.7 + PHP 7.0.22

Steps to reproduce

  1. Create the following structure:
class A {
  public function doSomething(){
     echo 'I do something! (original)';
  }
}

class B extends class A {
  public function parentDoSomething(){
     parent::doSomething();  
  }
}
  1. Now create an around plugin for the class A doSomething method:
public function aroundDoSomething(\Namespace\A $subject, callable $proceed){
        echo 'I do something else! (plugin)';
}
  1. Now execute $classB->parentDoSomething();

Expected result

I do something else! (plugin) should be printed

Actual result

I do something! (original) is printed

Other information

Calling $this->doSomething() in class B does produce the correct result.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P4No current plan to fix. Fixing can be deferred as a logical part of more important work.Progress: doneReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseSeverity: S4Affects aesthetics, professional look and feel, “quality” or “usability”.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject itstale issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions