Skip to content
This repository was archived by the owner on Mar 3, 2020. It is now read-only.

Commit 8e4151e

Browse files
justinwraygsingh93
authored andcommitted
HHVM/Hack Typing Error Fixes (#450)
* HHVM/Hack Typing Error Fixes * Fixed a few HHVM/Hack typing and strict compliance issues. * This is necessary before hh_client can run and be enforced during the build process. (See comments on #435) * * Updated formatting.
1 parent de72b28 commit 8e4151e

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

src/controllers/AdminController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2852,7 +2852,8 @@ class={$highlighted_color}
28522852
if (count($failures) > 0) {
28532853
$failures_tbody = <tbody></tbody>;
28542854
foreach ($failures as $failure) {
2855-
if (!Level::genCheckStatus($failure->getLevelId())) {
2855+
$check_status = await Level::genCheckStatus($failure->getLevelId());
2856+
if (!$check_status) {
28562857
continue;
28572858
}
28582859
$level = await Level::gen($failure->getLevelId());

src/controllers/Controller.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ abstract protected function genRenderBody(string $page): Awaitable<:xhp>;
1818
// TODO: Potential LFI - Review how to do internationalization better
1919
$document_root = must_have_string(Utils::getSERVER(), 'DOCUMENT_ROOT');
2020
$language_style = '';
21-
if (file_exists($document_root. '/static/css/locals/' .$language. '/style.css')) {
22-
$language_style = 'static/css/locals/' .$language. '/style.css';
21+
if (file_exists(
22+
$document_root.'/static/css/locals/'.$language.'/style.css',
23+
)) {
24+
$language_style = 'static/css/locals/'.$language.'/style.css';
2325
}
2426
return
2527
<x:doctype>

src/controllers/ajax/IndexAjaxController.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ protected function getActions(): array<string> {
109109
array<string> $names,
110110
array<string> $emails,
111111
): Awaitable<string> {
112+
$ldap_password = $password;
113+
112114
// Check if registration is enabled
113115
$registration = await Configuration::gen('registration');
114116
if ($registration->getValue() === '0') {
@@ -144,7 +146,6 @@ protected function getActions(): array<string> {
144146
// Use randomly generated password for local account for LDAP users
145147
// This will help avoid leaking users ldap passwords if the server's database
146148
// is compromised.
147-
$ldap_password = $password;
148149
$password = gmp_strval(
149150
gmp_init(bin2hex(openssl_random_pseudo_bytes(16)), 16),
150151
62,
@@ -189,6 +190,7 @@ protected function getActions(): array<string> {
189190
// Verify that this team name is not created yet
190191
$team_exists = await Team::genTeamExist($shortname);
191192
if (!$team_exists) {
193+
invariant(is_string($password), "Expected password to be a string");
192194
$password_hash = Team::generateHash($password);
193195
$team_id =
194196
await Team::genCreate($shortname, $password_hash, $logo_name);
@@ -205,9 +207,11 @@ protected function getActions(): array<string> {
205207
await Token::genUse($token, $team_id);
206208
}
207209
// Login the team
208-
if ($ldap->getValue() === '1')
209-
return await $this->genLoginTeam($team_id, $ldap_password); else
210+
if ($ldap->getValue() === '1') {
211+
return await $this->genLoginTeam($team_id, $ldap_password);
212+
} else {
210213
return await $this->genLoginTeam($team_id, $password);
214+
}
211215
} else {
212216
return Utils::error_response('Registration failed', 'registration');
213217
}

src/models/Category.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ private static function categoryFromRow(Map<string, string> $row): Category {
8383
if (!$mc_result || count($mc_result) === 0 || $refresh) {
8484
$db = await self::genDb();
8585
$categories = array();
86-
$result = await $db->queryf('SELECT * FROM categories ORDER BY category ASC');
86+
$result =
87+
await $db->queryf('SELECT * FROM categories ORDER BY category ASC');
8788
foreach ($result->mapRows() as $row) {
8889
$categories[] = self::categoryFromRow($row);
8990
}

0 commit comments

Comments
 (0)