The while loop in _quiz_delete_question() that is used to build the $quizzes_to_update array will always add false as the last item in the array.
This causes the following error when the first db_update() query in quiz_update_max_score_properties() is run on a Postgres database with false as one of the $quizzes_to_update:
PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "" LINE 6: WHERE (vid IN ('')) ^: UPDATE quiz_node_properties SET max_score=max_score_for_random * number_of_random_questions + ( SELECT COALESCE(SUM(max_score), 0) FROM quiz_node_relationship qnr WHERE qnr.question_status = 1 AND parent_vid = quiz_node_properties.vid) WHERE (vid IN (:db_condition_placeholder_0)) ; Array ( [target] => default [return] => 2 [already_prepared] => 1 ) in quiz_update_max_score_properties() (line 2292 of /home/bend/src/drupal7/sites/all/modules/quiz/quiz.module).
This issue can be reproduced with a fresh install of the quiz module on a site running with a Postgres database by creating a multiple choice quiz question and then attempting to delete it.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | quiz-quizzes_to_update_loop_fix-2560717-1-D7.patch | 612 bytes | ben.denham |
Comments
Comment #2
ben.denham commentedHere is a patch that fixes this issue by ensuring the final value of
falsereturned by$res->fetchField()is not added to the$quizzes_to_updatearray.Comment #3
djdevinGreat catch. Thanks!