The function renderOptionsLabel() contains bad logic. In the following conditional, the "else" can be executed when $value is not an array (i.e. when isset($options[$value]) returns FALSE), resulting in PHP warnings.

The code at fault (found in ui/ui.data.inc line 98):

      if (!is_array($value) && isset($options[$value])) {
        $value = $options[$value];
      }
      else {
        foreach ($value as $key => $single_value) {
          if (isset($options[$single_value])) {
            $value[$key] = $options[$single_value];
          }
        }
        $value = implode(', ', $value);
      }

If a non-array $value gets into the "else" statement, you get errors:

# Warning: Invalid argument supplied for foreach() in RulesDataUI::renderOptionsLabel() (line 102 of /xxx/sites/all/modules/rules/ui/ui.data.inc).
# Warning: implode() [function.implode]: Invalid arguments passed in RulesDataUI::renderOptionsLabel() (line 107 of /xxx/sites/all/modules/rules/ui/ui.data.inc).
CommentFileSizeAuthor
#5 logic-bug-1074262.patch802 bytestr
#1 logic-bug-1074262.patch802 bytestr

Comments

tr’s picture

Component: User Interface » User interface
Status: Active » Needs review
StatusFileSize
new802 bytes

... and the patch:

rfay’s picture

Status: Needs review » Needs work

Just setting this to CNW because the testbots are testing it over and over and I want them to catch up. Not sure what's going on. OK to retest later.

tr’s picture

Status: Needs work » Needs review
tr’s picture

Bump. This causes a big problem with Ubercart, and we're trying to get out a new beta release this week.

tr’s picture

StatusFileSize
new802 bytes

Let's try uploading that patch again - looks like the testbot forgot about it, and there's no way to restart.

Island Usurper’s picture

Clicking "View details" shows all green. Also fixes #1068782: /admin/store/settings/quotes/methods/usps invalid arugment RulesDataUI::renderOptionsLabel() errors, which is the where this bug report came from in the first place.

fago’s picture

Status: Needs review » Fixed

thanks, committed.

Status: Fixed » Closed (fixed)

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