Skip to content
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

PluginHelper::getPlugin returns array as default - object expected #44270

Closed
brbrbr opened this issue Oct 16, 2024 · 3 comments
Closed

PluginHelper::getPlugin returns array as default - object expected #44270

brbrbr opened this issue Oct 16, 2024 · 3 comments

Comments

@brbrbr
Copy link

brbrbr commented Oct 16, 2024

Steps to reproduce the issue

Disable the SEF plugin and enable maximum login

Expected result

No warnings

Actual result

Warning: Attempt to read property "params" on array in [ROOT]libraries/src/Component/Router/Rules/MenuRules.php

System information (as much as possible)

Joomla 5.2

Additional comments

PluginHelper::getPlugin should probably return an empty object for $plugin !== null

@Fedik
Copy link
Member

Fedik commented Oct 16, 2024

@Hackwar
Copy link
Member

Hackwar commented Oct 16, 2024

What does #42989 have to do with this?

Yes, the method sucks and eventually we should replace this with 2 methods instead of just one, but the behavior is correct. PluginHelper::getPlugin() states that it either returns an object or an array of objects. We can keep this ticket open to create another method PluginHelper::getPlugins() to solve this.

@Hackwar
Copy link
Member

Hackwar commented Oct 16, 2024

Ok, I understand what one has to do with the other. I'll create a PR to fix that. In the meantime I created #44282 to introduce a new method for retrieving a list of plugins. Thanks for reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants