The issue

No cookie duration was set when creating the poll, as it wasn't a required field. The installation is different too, as we're using Drupal Commerce: http://www.drupalcommerce.org/

The error messages

Notice: Undefined index: und in advpoll_get_data() (line 60 of /var/www/tradies/dev/sites/all/modules/advpoll/includes/advpoll_helper.inc).
Notice: Undefined index: und in advpoll_get_data() (line 60 of /var/www/tradies/dev/sites/all/modules/advpoll/includes/advpoll_helper.inc).
Notice: Undefined index: und in advpoll_get_data() (line 60 of /var/www/tradies/dev/sites/all/modules/advpoll/includes/advpoll_helper.inc).
Notice: Undefined index: und in advpoll_get_data() (line 60 of /var/www/tradies/dev/sites/all/modules/advpoll/includes/advpoll_helper.inc).
Notice: Undefined index: und in advpoll_get_data() (line 60 of /var/www/tradies/dev/sites/all/modules/advpoll/includes/advpoll_helper.inc).
Notice: Undefined index: und in advpoll_get_data() (line 60 of /var/www/tradies/dev/sites/all/modules/advpoll/includes/advpoll_helper.inc).

I tracked down the problem by using dpm() and this particular field was the culprit:

advpoll_helper.inc

dpm($node->advpoll_cookie_duration);

advpoll_helper.inc

(isset($node->advpoll_cookie_duration[$lang])) ? $data['cookie_duration'] = $node->advpoll_cookie_duration[$lang][0]['value'] : $data['cookie_duration'] = $node->advpoll_cookie_duration['und'][0]['value'];

Our fix

advpoll_helper.inc

(isset($node->advpoll_cookie_duration[$lang])) ? $data['cookie_duration'] = $node->advpoll_cookie_duration[$lang][0]['value'] : $data['cookie_duration'] = 
	(isset($node->advpoll_cookie_duration[LANGUAGE_NONE][0]['value']) ? $node->advpoll_cookie_duration['und'][0]['value'] : 0);

As I'm still new to PHP, I'm not sure if this is the best fix. There may be a more elegant solution, but this worked for us.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

SocialNicheGuru’s picture

Can a patch be made to apply and test?

jacob.embree’s picture

Hopefully this has the desired effect. It's a lot more readable, anyway. I have not tested this.

tripper54’s picture

Status: Needs review » Fixed

Great patch, thanks. Committed!

Status: Fixed » Closed (fixed)

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