Skip to content

Commit

Permalink
Fix wrong default-values changes of previous code
Browse files Browse the repository at this point in the history
  • Loading branch information
Beutlin committed Apr 19, 2023
1 parent 97e6421 commit 6f6cc38
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion application/api/controllers/HistoryController.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getHistory($request, $response)
$history = $this->history->getHistory();

// Return history operations from the {offset}th, starting from {since}.
$since = \DateTime::createFromFormat(\DateTime::ATOM, $request->getQueryParams()['since'] ?? null);
$since = \DateTime::createFromFormat(\DateTime::ATOM, $request->getQueryParams()['since'] ?? '');
$offset = $request->getQueryParams()['offset'] ?? null;
if (empty($offset)) {
$offset = 0;
Expand Down
4 changes: 2 additions & 2 deletions application/api/controllers/Tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class Tags extends ApiController
*/
public function getTags($request, $response)
{
$visibility = $request->getQueryParams()['visibility'] ?? '';
$visibility = $request->getQueryParams()['visibility'] ?? null;
$tags = $this->bookmarkService->bookmarksCountPerTag([], $visibility);

// Return tags from the {offset}th tag, starting from 0.
$offset = $request->getQueryParams()['offset'] ?? '';
$offset = $request->getQueryParams()['offset'] ?? null;
if (! empty($offset) && ! ctype_digit($offset)) {
throw new ApiBadParametersException('Invalid offset');
}
Expand Down
2 changes: 1 addition & 1 deletion application/front/controller/admin/ConfigureController.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function save(Request $request, Response $response): Response
}

$thumbnailsMode = extension_loaded('gd') ?
$request->getParsedBody()['enableThumbnails'] ?? null : Thumbnailer::MODE_NONE;
($request->getParsedBody()['enableThumbnails'] ?? null) : Thumbnailer::MODE_NONE;
if (
$thumbnailsMode !== Thumbnailer::MODE_NONE
&& $thumbnailsMode !== $this->container->get('conf')->get('thumbnails.mode', Thumbnailer::MODE_NONE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ protected function buildLinkDataFromUrl(array $params, string $url): array
$description = $params['description'] ?? null;
$tags = $params['tags'] ?? null;
if (($params['private'] ?? null) !== null) {
$private = filter_var($params['private'], FILTER_VALIDATE_BOOLEAN);
$private = filter_var($params['private'] ?? null, FILTER_VALIDATE_BOOLEAN);
} else {
$private = $this->container->get('conf')->get('privacy.default_private_links', false);
}
Expand Down
3 changes: 2 additions & 1 deletion application/front/controller/visitor/InstallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ public function save(Request $request, Response $response): Response
$request->getParsedBody()['city'] ?? null
)
) {
$timezone = $request->getParsedBody()['continent'] . '/' . $request->getParsedBody()['city'];
$timezone = ($request->getParsedBody()['continent'] ?? null) . '/' .
($request->getParsedBody()['city'] ?? null);
}
$this->container->get('conf')->set('general.timezone', $timezone);

Expand Down
2 changes: 1 addition & 1 deletion application/legacy/LegacyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ protected function taglist(Request $request, Response $response): Response
protected function daily(Request $request, Response $response): Response
{
$dayParam = !empty($request->getQueryParams()['day'] ?? null) ?
'?day=' . escape($request->getQueryParams()['day']) : '';
'?day=' . escape($request->getQueryParams()['day'] ?? null) : '';

return $this->redirect($response, '/daily' . $dayParam);
}
Expand Down

0 comments on commit 6f6cc38

Please sign in to comment.