-
Notifications
You must be signed in to change notification settings - Fork 9.4k
[FIX] dev:di:info duplicates plugin info #16474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FIX] dev:di:info duplicates plugin info #16474
Conversation
Hi @coderimus. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
} | ||
$this->pluginList[$this->pluginTypeMapping[$typeCode]][$pluginInstance][] = $pluginMethod ; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->pluginList[$this->pluginTypeMapping[$typeCode]][$pluginInstance][] = $pluginMethod ; ->
$this->pluginList[$this->pluginTypeMapping[$typeCode]][$pluginInstance][$pluginMethod] = 1
Please avoid duplication by reversing array. Please check if it is possible to remove if
while avoiding PHP notice.
$this->pluginList[$this->pluginTypeMapping[$typeCode]][$pluginInstance] = []; | ||
} | ||
|
||
if (!in_array($pluginMethod, $this->pluginList[$this->pluginTypeMapping[$typeCode]][$pluginInstance])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @orlangur ,
What do you think about this modification? I implemented this second condition just because it looks like a cheapest and still technologically possible solution. Also, this method is totally isolated and used only for this command.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too wordy and not elegant as to me but still good enough :) Asymptotic complexity became poor but should not be noticeable.
Good job with tiniest possible diff 👍
Hi @orlangur, thank you for the review. |
Hi @coderimus. Thank you for your contribution. Please, consider to port this solution to 2.3 release line. |
Description
Hello,
Looks like the execution of
dev:di:info
duplicates info about plugins by for the or the Preference if the same plugin class and its type were introduced in plugins by class name section.For example, execute

php bin/magento dev:di:info "Magento\Sales\Model\Order"
and the output result will bewith provided fix it will look like this
The problem is seems to be in this method:
It checks whether value exists in array or not. And if it exists it will be added +1 time. But it may logically to add an item once if it not exists.
Fixed Issues (if relevant)
N/A
Manual testing scenarios
execute
dev:di:info
command for class and check "Plugins for the Preference:" section. Seems to have duplicated info.Contribution checklist