I'm getting the following message with the newly patched dev.

Undefined index: und in question_answer_preprocess() (line 141 of /home/hopest/public_html/sites/all/modules/question_answer/question_answer.module).

any ideas?

Comments

jcisio’s picture

It looks like the node and the answer field do not use the same language!

Can you debug a little bit? At the line before, print the content of $node->{$qtype[$node->type]['answer']} and $node->language (the latter should be "und", but in case of...).

Stephen Rockwell’s picture

sure, just to be clear though I don't have localization or content translation modules turned on.

SlipperyJim’s picture

I'm getting the same error message with the most recent dev release. I don't have any localizations or non-English content and I'm running the most recent LAMP components (Ubuntu 10.10).

Notice: Undefined index: und in question_answer_preprocess() (line 141 of /var/www/drupal-7.0/sites/all/modules/question_answer/question_answer.module).

narnou’s picture

I have got exactly the same issue. Printing $qtype[$node->type]['answer'] gives me a string : field_best_answer

That's of course the name of the fileld i used for the module. But it's not an array so $node->{$qtype[$node->type]['answer']}['und'][0]['value'] should'nt work...

jcisio’s picture

If $qtype[$node->type]['answer'] == 'field_best_answer' then $node->{$qtype[$node->type]['answer']}['und'][0]['value'] == $node->field_best_answer['und'][0]['value'] and it should work.

Which version of PHP are you using?

narnou’s picture

Thx i'm gonna try this, my version is 5.3.5

Peter Arius’s picture

Title: with new fix for D7 getting undefined index error message » Undefined index: und in question_answer_preprocess() (line 141 of ... question_answer.module)
Category: support » bug

I still saw this error with:

  • latest dev version 7.x-1.6+5-dev from 2012-Mar-29
  • D7.12
  • PHP 5.3
  • English installation without locale etc. enabled

I found out that it only shows up when the selected_answer field is empty. I worked around it by making it a required field with default value 0.

HTH :).

Anonymous’s picture

Status: Fixed » Active

Got the error tonight. The workaround above didn't work for me.

It seems like the field has no language, while the node has. So using $node->language as index for the field is bad: should be using "und" instead. This is what I saw in the arrays via dpm().

The modules seems to have other serious problems here, so I can't help mucht about this issue. Just wanted to tell you about the circumstanced described above.

jcisio’s picture

Status: Active » Fixed

Status: Active » Closed (fixed)

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