I get the notice and warning below when viewing the results of a single multi-choice question test (using PHP 5.4). I expect the second one is from using PHP 5.4.x I just include it here since both popped up at the same time and involve the same function.
Notice: Undefined index: und in theme_quiz_admin_summary() (line 1792 of /usr/local/share/drupal7/modules/quiz/quiz.admin.inc).
Strict warning: Only variables should be passed by reference in theme_quiz_admin_summary() (line 1797 of /usr/local/share/drupal7/modules/quiz/quiz.admin.inc).
I am not (yet) a drupal wizard, so I have no idea if the 'und' index in $quiz->body['und'][0]['format'] is a typo or possibly something left over from the D6 version and no longer used in D7. I do see that it is used in several other quiz files including quiz.module and several of the files in /question_types/
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | patch.txt | 4.16 KB | Andy Dorman |
| #1 | patch.txt | 5.51 KB | Andy Dorman |
Comments
Comment #1
Andy Dorman commentedWell, based on this http://drupal.org/node/1239822 I have edited my code to replace 'und' with the Drupal constant, LANGUAGE_NONE.
But of course that only made the code more readable and did not fix the issue. Patch is attached in any case, just in case it helps anyone.
Comment #2
cicampemu commentedI have the same issue (working on the same version of Quiz).
Comment #3
Andy Dorman commentedOK, well I found other references to this issue for several other modules. The fix most other modules are using (and the only code fix I found) is to check that the value using the 'und' (LANGUAGE_NONE) index is set before you try to use it.
I can't help but believe there may be somewhere in the theme we are using (Omega) or a core module setting that we have not set that is leaving this value empty, but I have spent several hours searching and no luck so far.
So I used the technique other modules are using and modified the quiz code to check that either $node->body[LANGUAGE_NONE][0]['format'] or $quiz->body[LANGUAGE_NONE][0]['format'] exist before trying to use them. This patch only fixes the quiz features we are currently using. Looks like the long_answer & short_answer.admin.inc files have the same issue.
Thanks again to the quiz developers for an excellent module. Hope this contributes in some small way.
Comment #4
sivaji_ganesh_jojodae commentedCouldn't apply the patch. Will try to apply myself manually later.
Comment #5
kslagboom commentedI am getting the same error in 7.x-4.0 beta1. I attempted to manually apply the patch but things are not matching up.
Comment #6
sivaji_ganesh_jojodae commentedPatch committed. Thanks.
Comment #8
eyenology commentedCouldn't get patch to apply in 7.x-4.0-beta1