Skip to content

Commit

Permalink
feat: removed Symfony Cookie class for now because of compatability r…
Browse files Browse the repository at this point in the history
…easons
  • Loading branch information
thorsten committed Nov 15, 2024
1 parent 3e3c7af commit ee4ed19
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@
"symfony/config": "^7.1",
"symfony/dependency-injection": "^7.1",
"symfony/event-dispatcher": "^7.1",
"symfony/html-sanitizer": "^7.0",
"symfony/http-client": "^7.0",
"symfony/http-foundation": "^7.0",
"symfony/http-kernel": "^7.0",
"symfony/mailer": "^7.0",
"symfony/routing": "^7.0",
"symfony/html-sanitizer": "^7.1",
"symfony/http-client": "^7.1",
"symfony/http-foundation": "^7.1",
"symfony/http-kernel": "^7.1",
"symfony/mailer": "^7.1",
"symfony/routing": "^7.1",
"symfony/uid": "^7.1",
"tecnickcom/tcpdf": "~6.0",
"tivie/htaccess-parser": "*",
Expand Down
4 changes: 2 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions phpmyfaq/src/phpMyFAQ/User/CurrentUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* manually. login(), getFromSession() and getFromCookie() may be combined.
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* * v. 2.0. If a copy of the MPL was not distributed with this file, You can
* * obtain one at http://mozilla.org/MPL/2.0/.
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at https://mozilla.org/MPL/2.0/.
*
* @package phpMyFAQ
* @author Lars Tiedemann <php@larstiedemann.de>
Expand Down
18 changes: 8 additions & 10 deletions phpmyfaq/src/phpMyFAQ/User/UserSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
use phpMyFAQ\Filter;
use phpMyFAQ\Network;
use phpMyFAQ\Strings;
use Random\RandomException;
use Symfony\Component\HttpFoundation\Cookie;
use Symfony\Component\HttpFoundation\IpUtils;
use Symfony\Component\HttpFoundation\Request;

Expand Down Expand Up @@ -235,13 +233,13 @@ public function setCookie(string $name, int|string|null $sessionId, int $timeout
{
$request = Request::createFromGlobals();

Cookie::create($name)
->withValue($sessionId ?? '')
->withExpires($request->server->get('REQUEST_TIME') + $timeout)
->withPath(dirname($request->server->get('SCRIPT_NAME')))
->withDomain(parse_url($this->configuration->getDefaultUrl(), PHP_URL_HOST))
->withSameSite($strict ? 'strict' : '')
->withSecure($request->isSecure())
->withHttpOnly();
setcookie($name, $sessionId ?? '', [
'expires' => $request->server->get('REQUEST_TIME') + $timeout,
'path' => dirname($request->server->get('SCRIPT_NAME')),
'domain' => parse_url($this->configuration->getDefaultUrl(), PHP_URL_HOST),
'secure' => $request->isSecure(),
'httponly' => true,
'samesite' => $strict ? 'strict' : '',
]);
}
}

0 comments on commit ee4ed19

Please sign in to comment.