Here is the offending code from s \Drupal\entity\Tests\ContentTranslationWorkflowsTest::testWorkflows

    foreach ($ops as $current_op => $label) {
      $user = $this->drupalCreateUser(array($this->getTranslatePermission(), "$current_op content translations"));
      $this->drupalLogin($user);
      $this->drupalGet($translations_path);

      foreach ($ops as $op => $label) {
        if ($op != $current_op) {
          $this->assertNoLink($label, format_string('No %op link found.', array('%op' => $label)));
        }
        else {
          $this->assertLink($label, 0, format_string('%op link found.', array('%op' => $label)));
        }
      }
    }

For only a moment it left my brain going what which $label is important here!!!

since the $label in the outer loop is unused.. I dont think it will alter the execution flow through the loops.

CommentFileSizeAuthor
#1 label-2342237-1.patch970 bytesmartin107

Comments

martin107’s picture

StatusFileSize
new970 bytes
dawehner’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quickfix

Yeah it indeed doesn't change the behaviour but nice small improvement.

martin107’s picture

Ahem, I found a small cluster of these untraversable nested foreach loop lurking in core ... is an easier mistake to make than you might think....

martin107’s picture

Related issues:
martin107’s picture

d.o keeps mis-saving my related issues.. 4th time lucky

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.0.x, thanks!

  • catch committed 8dd6081 on 8.0.x
    Issue #2342237 by martin107: Fixed Cannot use the same variable in the...

Status: Fixed » Closed (fixed)

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