Bug: PHP warnings if validation failed in repeat group in any but first subgroup

VOI

Member
Hi,

I finally tried to use repeatable groups. The group has one textarea element with a validation. Anytime the validation fails in any but the first subgroup I get the following PHP warnings and the FabrikMainError message is not shown:

Code:
Warning: stripslashes() expects parameter 1 to be string, array given in /httpdocs/joomla3/plugins/fabrik_element/internalid/internalid.php on line 47
 
Warning: stripslashes() expects parameter 1 to be string, array given in /httpdocs/joomla3/plugins/fabrik_element/internalid/internalid.php on line 47
 
Warning: nl2br() expects parameter 1 to be string, array given in /httpdocs/joomla3/plugins/fabrik_element/textarea/textarea.php on line 300

If the form also contains some form-plugins an additional PHP notice is shown:

Code:
Notice: Undefined index: fmc_bugs_826_repeat___repeat_comment in /httpdocs/joomla3/components/com_fabrik/models/plugin-form.php on line 279

Last one seems to be a similar issue as the one fixed by this commit: https://github.com/Fabrik/fabrik/commit/41e3353c9c5066b3608faacaa6e8697e15f99cfe

If the validaiton fails for the first subgroup in the repeatable group only or in the first subgroup and any subsequemt subgroups the erros are NOT shown.

This happens for notempty and PHP validations - did not test for any other validation types.

To replicate the error I set up a simple test list with just a repetable group containing only one element except id and parent_id and without any further modifications (template, JS, ...) - the same bug showed up. To have a look at this test list, log into my J!3.2 site - go to the "TM" top-menu and open the "Test List - Repeat Group" entry.

Chris
 
Just as well I didn't commit my fix, as it seems to have broken saving of repeat data when no validation failures.

Still working on it.

-- hugh
 
I haven't forgotten about this one, I'm just trying to vector some time with Rob so we can work out the best approach for a fix.

-- hugh
 
NOTE for Rob:

The problem is in hasError() in the form model, where we do:

PHP:
                if (!empty($errors[0]))
                {
                    $errorsFound = true;
                }

... which only tests the first instance or a repeat group. But if I change that to iterate through the $errors[] array and return true if any of them are not empty, for some reason I'm then losing data when there are no errors. Ran out of time trying to debug it, handing it over the fence to you!

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top