From: ArthurHoaro Date: Wed, 28 Oct 2020 13:02:08 +0000 (+0100) Subject: Fix compatiliby issue on login with PHP 7.1 X-Git-Tag: v0.12.1^2~20^2 X-Git-Url: https://git.immae.eu/?p=github%2Fshaarli%2FShaarli.git;a=commitdiff_plain;h=d3f6d525253eb7bb041d9436cbf213c10524a85c Fix compatiliby issue on login with PHP 7.1 session_set_cookie_params does not return any value in PHP 7.1 --- diff --git a/application/render/PageBuilder.php b/application/render/PageBuilder.php index 25e0e284..c2fae705 100644 --- a/application/render/PageBuilder.php +++ b/application/render/PageBuilder.php @@ -160,7 +160,7 @@ class PageBuilder $this->tpl->assign('formatter', $this->conf->get('formatter', 'default')); - $this->tpl->assign('links_per_page', $this->session['LINKS_PER_PAGE']); + $this->tpl->assign('links_per_page', $this->session['LINKS_PER_PAGE'] ?? 20); // To be removed with a proper theme configuration. $this->tpl->assign('conf', $this->conf); diff --git a/application/security/SessionManager.php b/application/security/SessionManager.php index 36df8c1c..96bf193c 100644 --- a/application/security/SessionManager.php +++ b/application/security/SessionManager.php @@ -293,9 +293,12 @@ class SessionManager return session_start(); } - public function cookieParameters(int $lifeTime, string $path, string $domain): bool + /** + * Be careful, return type of session_set_cookie_params() changed between PHP 7.1 and 7.2. + */ + public function cookieParameters(int $lifeTime, string $path, string $domain): void { - return session_set_cookie_params($lifeTime, $path, $domain); + session_set_cookie_params($lifeTime, $path, $domain); } public function regenerateId(bool $deleteOldSession = false): bool