No Code Attached Yet bug
avatar counterpoint
counterpoint
8 Aug 2022

Steps to reproduce the issue

Create a plugin to handle onExtensionBeforeSave and onExtensionAfterSave. Put in diagnostics based on Joomla\CMS\Component\ComponentHelper::getParams() to show or save one of the option values. Change the option value and save. Note that both of the plugin methods show the old value, even though the new value is in the database.

Expected result

The new value for the option should appear in the result returned by Joomla\CMS\Component\ComponentHelper::getParams()

Actual result

The old value is returned by Joomla\CMS\Component\ComponentHelper::getParams()

System information (as much as possible)

Logical problem, will occur in any system.

Additional comments

This very much reduces the usefulness of the plugin hooks since there is no way to detect what has happened in the onExtensionAfterSave code.

avatar counterpoint counterpoint - open - 8 Aug 2022
avatar counterpoint counterpoint - change - 8 Aug 2022
Labels Removed: ?
avatar joomla-cms-bot joomla-cms-bot - change - 8 Aug 2022
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 8 Aug 2022
avatar khobraariyadh
khobraariyadh - comment - 22 Aug 2022

Spam removed.

avatar laoneo
laoneo - comment - 22 Aug 2022

Does the second parameter in the event not have the new value? It should, then you can use that one and go from there. Better than relying on an external function. Not sure about the consequences when this functionality changes, as it exists since 8 years.

avatar Hackwar Hackwar - change - 22 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 22 Feb 2023
avatar Hackwar Hackwar - change - 25 Sep 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-09-25 18:47:22
Closed_By Hackwar
avatar Hackwar Hackwar - close - 25 Sep 2024
avatar Hackwar
Hackwar - comment - 25 Sep 2024

Hello @counterpoint, sorry that this took so long. I understand what you are trying to do, however I disagree that this is a bug and we wont be fixing this. Yes, the data in ComponentHelper::getParams() is not updated during the request when the component parameters are updated in the database. However it is expected that this isn't necessary. If your extension updates the component params and needs to access them afterwards, the expectation would be that your extension also updates the value in ComponentHelper::getParams(). You can do so by simply updating the value(s) in the registry object returned by getParams(). You can also compare the old value from ComponentHelper::getParams() with what is saved in the database in the events you mentioned above.

So to summarise: If you need to edit the configuration and have the result of ComponentHelper::getParams() updated in the same request, then you have to take care of that yourself. We are not going to update this in the system. Because of this, I'm closing this issue.

Add a Comment

Login with GitHub to post a comment