Line 219 of select_or_other.module is:

if ($element['#select_or_other_checkboxes']) {

This generate a PHP-notice. Could it be changed to the following?

if (isset($element['#select_or_other_checkboxes'])) {

Comments

danielb’s picture

Just curious - are you using a development version of Drupal core?
These notices are suppressed in my Drupal 6 setup.

I think we'll need to test both isset() and keep the current evaluation of the variable.

danielb’s picture

Status: Needs review » Fixed
danielb’s picture

Component: Webform » Miscellaneous

ps wtf did this have to do with webform?

liam morland’s picture

Just curious - are you using a development version of Drupal core?
These notices are suppressed in my Drupal 6 setup.

This can be configured in your php.ini. I don't think the version of Drupal core would effect this.

I think we'll need to test both isset() and keep the current evaluation of the variable.

You could do this instead of two separate checks:

if (!empty($element['#select_or_other_checkboxes'])) {
danielb’s picture

I don't think the version of Drupal core would effect this.

From what I've read it makes a difference whether you install an official drupal 6 release vs. a development release. The development release forces the notices to show to assist development. I think Drupal 7 always shows them no matter what.

if (!empty($element['#select_or_other_checkboxes'])) {

That would still display the notice....

liam morland’s picture

It does not display the notice. I just tried it and the PHP documentation says "no warning is generated when the variable is not set". Cheers.

danielb’s picture

Really? I've been complaining about this for ages. I'm sure I've been given bug reports to add an isset() before a !empty().
Well that's good to know, cheers, I'll try to do that from now on.

Jorrit’s picture

I use the devel module to disable the Drupal error handler. In that way, I do get notices about errors in my own developed modules. For me, this helps avoiding problems like mistyped variable names that go unspotted easily in PHP. However, for this approach to work all contrib modules I use need to be E_NOTICE proof as well. That's why I requested this small change. Thanks for implementing it!

Status: Fixed » Closed (fixed)

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