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/

CommentFileSizeAuthor
#3 patch.txt4.16 KBAndy Dorman
#1 patch.txt5.51 KBAndy Dorman

Comments

Andy Dorman’s picture

StatusFileSize
new5.51 KB

Well, 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.

cicampemu’s picture

I have the same issue (working on the same version of Quiz).

Andy Dorman’s picture

Title: Notice: Undefined index: und in theme_quiz_admin_summary() » Notice: Undefined index: und in theme_quiz_admin_summary(), Working Patch
StatusFileSize
new4.16 KB

OK, 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.

sivaji_ganesh_jojodae’s picture

Couldn't apply the patch. Will try to apply myself manually later.

kslagboom’s picture

Version: 7.x-4.0-alpha12 » 7.x-4.0-beta1

I am getting the same error in 7.x-4.0 beta1. I attempted to manually apply the patch but things are not matching up.

sivaji_ganesh_jojodae’s picture

Status: Active » Fixed

Patch committed. Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

eyenology’s picture

Couldn't get patch to apply in 7.x-4.0-beta1

  • Commit 1b82979 on 7.x-4.x, 7.x-5.x by sivaji:
    Issue #1921538 by Andy Dorman: Fixed Notice: Undefined index: und in...

  • Commit 1b82979 on 7.x-4.x, 7.x-5.x, quiz-pages by sivaji:
    Issue #1921538 by Andy Dorman: Fixed Notice: Undefined index: und in...

  • Commit 1b82979 on 7.x-4.x, 7.x-5.x, quiz-pages, 2269219 by sivaji:
    Issue #1921538 by Andy Dorman: Fixed Notice: Undefined index: und in...

  • Commit 1b82979 on 7.x-4.x, 7.x-5.x, 2269219 by sivaji:
    Issue #1921538 by Andy Dorman: Fixed Notice: Undefined index: und in...