-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
JForm object loaded without data when first called with load_data option false #17700
Comments
@conflate-nl can you please look at latest staging if this Issue still occur? |
If this Issue get no Response, it will be closed at 26th January 2018. |
Just want to add that this is is a valid issue (I saw it when I worked on the PR #19145) |
@joomdonation thanks for Info, Issue stay open. |
Thank you for raising this issue. Joomla 3 is now in security only mode with no further bug fixes or new features. As this issue doesn't relate to Joomla 4 it will now been closed. If we are mistaken and this does apply to Joomla 4 please open a new issue (and reference this one if you wish) with updated details for testing in Joomla 4. |
Steps to reproduce the issue
In the model of a component singular item, is a function called getForm which calls the parent function loadForm with the options to create a JForm object. The function getForm has a param loadData which defaults to true. When this function is first called with loadData set to false, and then called with loadData set to true, the JForm is returned without any data. There's a change whitch removes the setting for loading data when creating a signature, and then returns any previously loaded forms. The new code has this comment in file libraries/legacy/model/form.php ln 203:
// Create a signature hash. But make sure, that loading the data does not create a new instance
$sigoptions = $options;
I get the fact that we can use the previously created JForm, but now the entire loading of the data section is omitted, thus returning an JForm object without data.
Expected result
When setting the loadData to true, the data is actually loaded, regardless if the Form was created before.
Actual result
Empty JForm object, that is the JForm object is created correctly but with no data binded, even though the option specifies it should load it.
System information (as much as possible)
Joomla 3.7.4.
Additional comments
This problem is since Joomla 3.7.4, in 3.7.3 is was working fine. The problem lies in the fact that the signature is created regardless of the load data setting, which is fine, we don't need to create a new instance if the only difference is loading data, but the option should be handled when it is set to load.
Here is the code that generates the new hash, and if it exists, returns the object straight away, without rechecking if the data should be loaded. Of course there is the clear switch, but always setting this to true to make the data get loaded, is still not utilizing the previously created object.
$sigoptions = $options;
if (isset($sigoptions['load_data']))
{
unset($sigoptions['load_data']);
}
$hash = md5($source . serialize($sigoptions));
// Check if we can use a previously loaded form.
if (isset($this->_forms[$hash]) && !$clear)
{
return $this->_forms[$hash];
}
The text was updated successfully, but these errors were encountered: