Details

At the end of course/edit_form.php function 'definition()' add the following line:
$mform->insertElementBefore($mform->createElement('static', 'testing', 'This is a test', 'The test text'), 'idnumber');

The element appears as expected, but there is also the following error message:
Notice: Undefined index: in [folder-removed]/lib/pear/HTML/QuickForm.php on line 679
Warning: array_search() expects parameter 2 to be array, null given in[folder-removed]/lib/pear/HTML/QuickForm.php on line 679

At the end of course/edit_form.php function 'definition()' add the following line:
$mform->insertElementBefore($mform->createElement('static', 'testing', 'This is a test', 'The test text'), 'idnumber');
The element appears as expected, but there is also the following error message:
Notice: Undefined index: in [folder-removed] /lib/pear/HTML/QuickForm.php on line 679
Warning: array_search() expects parameter 2 to be array, null given in [folder-removed] /lib/pear/HTML/QuickForm.php on line 679

Description

When adding an element, the duplicates array is not updated if the element has no name.
However, when using the 'insertElementBefore' function, it is assumed that all duplicate elements are contained in the duplicates array.

I've attached the one-line patch.

Note the test below uses the course edit form for convenience, as it is already set up, but this will affect any forms with multiple unnamed entries.

the main moodle.git repository has been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

Eloy Lafuente (stronk7)
added a comment - 10/Mar/12 5:30 AM Some hours ago...
the main moodle.git repository has been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.
TIA and ciao

Thanks Davo, this has been integrated now.
I'd only been integrated on master, 22, and 21 though sorry. 20 and 19 branches are now only receiving security patches or patches that have been agreed upon and are considered necessary.

Sam Hemelryk
added a comment - 14/Mar/12 6:56 AM Thanks Davo, this has been integrated now.
I'd only been integrated on master, 22, and 21 though sorry. 20 and 19 branches are now only receiving security patches or patches that have been agreed upon and are considered necessary.
Cheers
Sam