Skip to content

Commit e99461f

Browse files
committed
replace die with redirectexception
1 parent 8814abd commit e99461f

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

resources/autoload.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
require_once __DIR__ . "/lib/UnityWebhook.php";
2121
require_once __DIR__ . "/lib/UnityRedis.php";
2222
require_once __DIR__ . "/lib/UnityGithub.php";
23+
require_once __DIR__ . "/lib/exceptions/RedirectException.php";
2324

2425
// run init script
2526
require __DIR__ . "/init.php";

resources/lib/UnitySite.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static function redirect($destination)
1010
{
1111
if ($_SERVER["PHP_SELF"] != $destination) {
1212
header("Location: $destination");
13-
die("Redirect failed, click <a href='$destination'>here</a> to continue.");
13+
throw new RedirectException("Redirect failed, click <a href='$destination'>here</a> to continue.");
1414
}
1515
}
1616

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
namespace UnityWebPortal\lib;
4+
5+
class RedirectException extends \Exception
6+
{
7+
}

test/phpunit-bootstrap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
require_once __DIR__ . "/../resources/lib/UnityWebhook.php";
1515
require_once __DIR__ . "/../resources/lib/UnityRedis.php";
1616
require_once __DIR__ . "/../resources/lib/UnityGithub.php";
17+
require_once __DIR__ . "/../resources/lib/exceptions/RedirectException.php";
1718

1819
global $HTTP_HEADER_TEST_INPUTS;
1920
$HTTP_HEADER_TEST_INPUTS = [

0 commit comments

Comments
 (0)