PluginA-before method
PluginB-before method
Base Class
PluginB-after method
PluginA-after method
PluginA-before method
PluginB-before method
Base Class
PluginA-after method
PluginB-after method
Attached is proof of concept module. Run with php bin/magento Gw:consoletest and then inspect var/log/system.log for output
<type name="Gw\ConsoleTest\Model\TestClass">
<plugin name="TestPluginA" type="Gw\ConsoleTest\Model\TestPluginA" sortOrder="10"/>
</type>
<type name="Gw\ConsoleTest\Model\TestClass">
<plugin name="TestPluginB" type="Gw\ConsoleTest\Model\TestPluginB" sortOrder="20"/>
</type>
[2019-10-18 13:20:19] main.INFO: TestPluginA::beforeMainFunctionCall [] []
[2019-10-18 13:20:19] main.INFO: TestPluginB::beforeMainFunctionCall [] []
[2019-10-18 13:20:19] main.INFO: TestClass::mainFunctionCall [] []
[2019-10-18 13:20:19] main.INFO: TestPluginA::afterMainFunctionCall [] []
[2019-10-18 13:20:19] main.INFO: TestPluginB::afterMainFunctionCall [] []
Hi @gwharton. Thank you for your report.
To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.3-develop instance - upcoming 2.3.x release
For more details, please, review the Magento Contributor Assistant documentation.
@gwharton do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
Hi @dmytro-ch. 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:
Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.[x] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.
[x] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.
[x] 4. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.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.
:white_check_mark: Confirmed by @dmytro-ch
Thank you for verifying the issue. Based on the provided information internal tickets MC-21985 were created
Issue Available: @dmytro-ch, _You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself._
Pretty good question. We discussed this problem with @shrielenee in https://github.com/magento/devdocs/issues/3200.
Per my debug I've detected the next plugins sequence :
For example, we have some class with execute method.
For this method we have 2 plugins:
Plugin A (sortOrder = 10)aroundExecute methodafterExecute methodPlugin B (sortOrder = 20)beforeExecute methodaroundExecute methodafterExecute methodExecution queue:
Plugin A::aroundExecute (sortOrder=10)Plugin B::beforeExecute (sortOrder=20)Plugin B::aroundExecute (sortOrder=20)execute method of native classPlugin B::afterExecute (sortOrder=20)Plugin A::afterExecute (sortOrder=10)CC: @dmytro-ch
Hi @GDauer. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:
Component: XXXXX label(s) to the ticket, indicating the components it may be related to.[x] 2. Verify that the issue is reproducible on 2.3-develop branchDetails
- Add the comment @magento give me 2.3-develop instance to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and _stop verification process here_!
[ ] 3. If the issue is not relevant or is not reproducible any more, feel free to close it.
Just have tried the same example as the documentation and seems we have a bug. Apparently the problem is in the last two after Plugins:

Still broken in 2.4.0
[2020-08-13 15:06:16] main.INFO: TestPluginA::beforeMainFunctionCall [] []
[2020-08-13 15:06:16] main.INFO: TestPluginB::beforeMainFunctionCall [] []
[2020-08-13 15:06:16] main.INFO: TestClass::mainFunctionCall [] []
[2020-08-13 15:06:16] main.INFO: TestPluginA::afterMainFunctionCall [] []
[2020-08-13 15:06:16] main.INFO: TestPluginB::afterMainFunctionCall [] []
seem your case is scenario A like docs https://devdocs.magento.com/guides/v2.4/extension-dev-guide/plugins.html
What wrong with order executed
Indeed, seems it was less intrusive/problematic to fix the documentation instead of the bug. 馃榾
It's really disappointing. The dev certification questions are still based on the original version of the scenario. While the official documentation does not reflect it anymore.
Updating the documentation instead of fixing the root of the issue is not the best idea.