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

JForm object loaded without data when first called with load_data option false #17700

Closed
ghost opened this issue Aug 24, 2017 · 5 comments
Closed

Comments

@ghost
Copy link

ghost commented Aug 24, 2017

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];
}

@ghost
Copy link

ghost commented Nov 25, 2017

@conflate-nl can you please look at latest staging if this Issue still occur?

@ghost
Copy link

ghost commented Dec 26, 2017

If this Issue get no Response, it will be closed at 26th January 2018.

@joomdonation
Copy link
Contributor

Just want to add that this is is a valid issue (I saw it when I worked on the PR #19145)

@ghost
Copy link

ghost commented Dec 26, 2017

@joomdonation thanks for Info, Issue stay open.

@brianteeman
Copy link
Contributor

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.
cc @zero-24

@zero-24 zero-24 closed this as completed Aug 23, 2022
@crystalenka crystalenka moved this to Backlog in Issue Cleanup Oct 7, 2022
@crystalenka crystalenka moved this from Backlog to Irrelevant - Close Issue in Issue Cleanup Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

4 participants