It is quite tricky to reproduce this bug, so you will need to follow these instructions closely.
1. Create a quiz set to use interactive behaviour with one short-answer question as follows:
Question name: Regrade test.
Question text: What is the best amphibian?
Answer 1 -> Answer: Toad
Answer 1 -> Grade: 100%
Hint 1 -> Hint text: Hint 1
2. Attempt the quiz as a student.
3. First, give the response 'Frog' and click Check.
4. Click Try again.
5. Give the response 'Toad' and click Check.
6. Click Next
7. Click Submit all and finish.
8. Now, as teacher, edit the question and change
Answer 1 -> Answer: Frog
9. Go to Results -> Grades, and click the regrade all button.
10. Verify that the student's grade changes from 66.67% (or whatever it was) to 100%, and more importantly that there are no fatal errors.
Having tested this specific case, you are encouraged to test some other regrades, to help verify that there are no other regressions I have not thought of.

Description

Bjorn Hilmarsson mentioned in the moodle.org forum a problem with regrading quizzes. Tim Hunt noted the bug, and suggested to Bjorn to post it in tracker. I am doing this on behalf of both Bjorn and Tim. Tim said he would fix this bug quickly.

Tim Hunt
added a comment - 01/Mar/12 6:35 AM Thanks Rick.
I think the correct fix is to change lines 809-810 of question/engine/datalib.php from
$this->db->delete_records_select('question_attempt_steps',
"attemptstepid $test", $params);
to
$this->db->delete_records_select('question_attempt_steps',
"id $test", $params);
If anyone can test that and confirm, that would be really helpful. Anyway, I will try to make this into a proper fix and apply it tomorrow.

Eloy Lafuente (stronk7)
added a comment - 10/Mar/12 5:28 AM Your changes are now upstream and will be included in the next minor released scheduled for March 13th (next Monday!).
icao_reverse('arreis olik rebemevon afla letoh ognat');
Closing, ciao

Are you sure the testing instructions for this bug are ok? I've just tested in 2.2.1 without the fix and there is no problems... If the patch really fixes a bug, can you provide me any testing instructions that will reproduce it?

Jean-Philippe Gaudreau
added a comment - 02/Apr/12 9:17 PM Hi guys,
Are you sure the testing instructions for this bug are ok? I've just tested in 2.2.1 without the fix and there is no problems... If the patch really fixes a bug, can you provide me any testing instructions that will reproduce it?
thx!

Note the bit above where it says "This issue is a regression caused by: MDL-30484". There were no problems in Moodle 2.2.1 (well, there were other more serious problems, which is what MDL-30484 fixed). This problem created and fixed between 2.2.1 and 2.2.2.

Tim Hunt
added a comment - 02/Apr/12 9:53 PM Note the bit above where it says "This issue is a regression caused by: MDL-30484 ". There were no problems in Moodle 2.2.1 (well, there were other more serious problems, which is what MDL-30484 fixed). This problem created and fixed between 2.2.1 and 2.2.2.