forked from md-systems/redirect
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect redirect loops before redirecting.
- Redirects are searched for recursively to avoid loops. - Addresses issue md-systems#16.
- Loading branch information
Showing
5 changed files
with
130 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
/** | ||
* @file | ||
* Contains \Drupal\redirect\Exception\RedirectLoopException. | ||
*/ | ||
|
||
namespace Drupal\redirect\Exception; | ||
|
||
use Drupal\Component\Utility\SafeMarkup; | ||
|
||
/** | ||
* Exception for when a redirect loop is detected. | ||
*/ | ||
class RedirectLoopException extends \RuntimeException { | ||
|
||
/** | ||
* Formats a redirect loop exception message. | ||
* | ||
* @param string $path | ||
* The path that results in a redirect loop. | ||
* @param int $rid | ||
* The redirect ID that is involved in a loop. | ||
*/ | ||
public function __construct($path, $rid) { | ||
parent::__construct(SafeMarkup::format('Redirect loop identified at %path for redirect %rid', ['%path' => $path, '%rid' => $rid])); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters