Skip to content

Commit cc8838e

Browse files
committed
Login: askPermissions() callback must die() by own
1 parent 2ae52c3 commit cc8838e

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/Github/OAuth/Login.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,10 @@ public function askPermissions($backUrl, $redirectCb = NULL)
6767
$url = $this->authUrl . '?' . http_build_query($params);
6868
if ($redirectCb === NULL) {
6969
header("Location: $url");
70+
die();
7071
} else {
7172
call_user_func($redirectCb, $url);
7273
}
73-
74-
die();
7574
}
7675

7776

tests/Github/OAuth/Login.askPermissions.own.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* @author Miloslav Hůla
55
*
6-
* @outputMatch Was called
6+
* @outputMatch Was called. Must die by own.
77
*/
88

99
require __DIR__ . '/../../bootstrap.php';
@@ -17,7 +17,7 @@ $storage = new Milo\Github\Storages\SessionStorage;
1717
$login = new Milo\Github\OAuth\Login($config, $storage);
1818
$login->askPermissions('http://', function($url) {
1919
Assert::match('https://github.com/login/oauth/authorize?client_id=i&redirect_uri=http%3A%2F%2F&scope=&state=%h%', $url);
20-
echo "Was called";
20+
echo "Was called. ";
2121
});
2222

23-
throw new \Exception('Must not be there.');
23+
echo "Must die by own.";

0 commit comments

Comments
 (0)