The for loop is not doing what the programmer intended.

Reported by a lint check in \Drupal\views_ui\Tests\DisplayFeedTest::checkFeedViewUi

The variable 'value' used by a foreach loop is already used in the same way by the outer foreach loop...

Expressed in my words "Ah rats I can't reuse $value again in the inner loop..."

    foreach ($result as $value) {
      foreach ($value->input->attributes() as $attribute => $value) {
        if ($attribute == 'value') {
          $options[] = (string) $value;
        }
      }
 

My fix is to introduce a local variable called $item, for the first use of $value.

CommentFileSizeAuthor
item-0.patch766 bytesmartin107

Comments

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Yeah why not.

martin107’s picture

Issue tags: +Quickfix
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.0.x, thanks!

  • catch committed 74e0d63 on 8.0.x
    Issue #2342227 by martin107: Fixed untraversable for loop in...

Status: Fixed » Closed (fixed)

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