Skip to content
Snippets Groups Projects
Commit 94ea8a87 authored by Sascha Grossenbacher's avatar Sascha Grossenbacher Committed by Lucas Hedding
Browse files

Issue #3033455 by berdir, mrossi113, acbramley, olli, heddn: 500 error: Possible infinite loop

parent 5eb752fc
No related branches found
No related tags found
1 merge request!118Resolve #3033455 "2.x"
Pipeline #370319 failed
...@@ -235,7 +235,7 @@ class PluginRevisionController extends ControllerBase { ...@@ -235,7 +235,7 @@ class PluginRevisionController extends ControllerBase {
]; ];
$i = 0; $i = 0;
// Find the previous revision. // Find the previous revision.
while ($left_revision_id > $revision_ids[$i]) { while (!empty($revision_ids[$i]) && $left_revision_id > $revision_ids[$i]) {
$i += 1; $i += 1;
} }
if ($i != 0) { if ($i != 0) {
...@@ -250,7 +250,7 @@ class PluginRevisionController extends ControllerBase { ...@@ -250,7 +250,7 @@ class PluginRevisionController extends ControllerBase {
]; ];
// Find the next revision. // Find the next revision.
$i = 0; $i = 0;
while ($i < $revisions_count && $right_revision_id >= $revision_ids[$i]) { while (!empty($revision_ids[$i]) && $right_revision_id >= $revision_ids[$i]) {
$i += 1; $i += 1;
} }
if ($revisions_count != $i && $revision_ids[$i - 1] != $revision_ids[$revisions_count - 1]) { if ($revisions_count != $i && $revision_ids[$i - 1] != $revision_ids[$revisions_count - 1]) {
......
...@@ -151,6 +151,7 @@ class DiffLocaleTest extends DiffTestBase { ...@@ -151,6 +151,7 @@ class DiffLocaleTest extends DiffTestBase {
$french_node->setTitle('french_revision_2'); $french_node->setTitle('french_revision_2');
$french_node->setNewRevision(TRUE); $french_node->setNewRevision(TRUE);
$french_node->save(); $french_node->save();
$revision5 = $french_node->getRevisionId();
// Compare first two revisions. // Compare first two revisions.
$this->drupalGet('node/' . $node->id() . '/revisions/view/' . $revision1 . '/' . $revision2 . '/split_fields'); $this->drupalGet('node/' . $node->id() . '/revisions/view/' . $revision1 . '/' . $revision2 . '/split_fields');
...@@ -166,6 +167,12 @@ class DiffLocaleTest extends DiffTestBase { ...@@ -166,6 +167,12 @@ class DiffLocaleTest extends DiffTestBase {
// There shouldn't be other differences in the current language. // There shouldn't be other differences in the current language.
$this->assertSession()->linkNotExists('Next change'); $this->assertSession()->linkNotExists('Next change');
// Attempt to visit with a valid revision but for the wrong language.
$this->drupalGet('node/' . $node->id() . '/revisions/view/' . $revision5 . '/' . $revision1 . '/split_fields');
$diffs = $this->getSession()->getPage()->findAll('xpath', '//span[@class="diffchange"]');
$this->assertEquals($diffs[0]->getText(), 'english_revision_2');
$this->assertEquals($diffs[1]->getText(), 'english_revision_0');
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment