I am getting a notice when adding a checkbox field to a report when running the latest version of Webform (7.x-4.0-rc4):

Notice: Undefined index: nid in _webform_select_options() (line 887 of /var/www/contracts/sites/all/modules/contrib/webform/components/select.inc).

The stacktrace points to the following line:

sites/all/modules/contrib/webform_report/webform_report.inc:376

 372         if (function_exists('_webform_select_options_callback')) {
 373           // make a webform "component"
 374           $wfcomp['extra'] = $extra;
 375           // get select options
 376           $columns[$index]['pairs'] = _webform_select_options($wfcomp);
 377         }

Here is the declaration for _webform_select_options():

function _webform_select_options($component, $flat = FALSE, $filter = TRUE)

As long as $filter is TRUE, _webform_select_options() expects 'nid' as an array key for '$wfcomp', a.k.a. '$component'. '$wfcomp' is created in line 374 above, and as you can see, the key 'nid' is never created.

It seems to me that there are three possible solutions:

A. call _webform_select_options() with the $filter set to FALSE
B. add the 'nid' key to '$wfcomp'
C. file a bug report with webform

They're all really simple fixes, but I'll leave the solution to someone who understand the intent of this function better than I.

CommentFileSizeAuthor
#3 webform_report-2307639.patch542 bytespgsengstock
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jbulcher’s picture

Issue summary: View changes

add a third solution

waluyo.umam’s picture

I have the same problem.
Can you explain clearly how to solve this.

pgsengstock’s picture

FileSize
542 bytes
pgsengstock’s picture

My patch took the path of least resistance (option A: call _webform_select_options() with the $filter set to FALSE). Works well enough for our implementation, but others should probably test on their own. Also, this patch was made against the 7.x-1.x dev version. Haven't submitted a drupal patch before, so apologies if I did it wrong.

waluyo.umam’s picture

Thank you pgsengstock, your patch #3 works for me.
Now I don't have any notice warning again.

srutland’s picture

Thanks. Worked for our app too though don't know the full ramifications of passing FALSE and FALSE. No more warning notices "Notice: Undefined index: nid in _webform_select_options() (line 888 of /apps/drupal/html/sites/all/modules/webform/components/select.inc)"

varenius’s picture

Thanks. I also changed the function args to FALSE, FALSE as described above and it works to avoid the notice.

Temmest’s picture

Thanks @pgsengstock your patch #3 works for me.

aubjr_drupal’s picture

Status: Active » Needs review

Another vote for patch in #3. Can someone review this?

rjt1224’s picture

Seems to be working well once patch #3 is applied.