Skip to content
Snippets Groups Projects
Commit c8e8d6d2 authored by Sascha Grossenbacher's avatar Sascha Grossenbacher Committed by Sascha Grossenbacher
Browse files

Issue #3059894 by nileema19, Berdir: Redirect loop can occur in sub-requests

parent cb653986
Branches
Tags
No related merge requests found
......@@ -99,6 +99,8 @@ class RedirectRepository {
return $redirect;
}
// Reset found redirects.
$this->foundRedirects = [];
return NULL;
}
......
......@@ -239,6 +239,32 @@ class RedirectAPITest extends KernelTestBase {
}
}
/**
* Test loop detection reset.
*/
public function testLoopDetectionReset() {
// Add a chained redirect that isn't a loop.
/** @var \Drupal\redirect\Entity\Redirect $source */
$source = $this->controller->create();
$source->setSource('source-redirect');
$source->setRedirect('target');
$source->save();
/** @var \Drupal\redirect\Entity\Redirect $target */
$target = $this->controller->create();
$target->setSource('target');
$target->setRedirect('second-target');
$target->save();
/** @var \Drupal\redirect\RedirectRepository $repository */
$repository = \Drupal::service('redirect.repository');
$found = $repository->findMatchingRedirect('target');
$this->assertEquals($target->id(), $found->id());
$found = $repository->findMatchingRedirect('source-redirect');
$this->assertEquals($target->id(), $found->id());
}
/**
* Test redirect_parse_url().
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment