From b827340dee8dde05541b75a8df00c4805d8e16bb Mon Sep 17 00:00:00 2001 From: Shun Zi <20991618+shunf4@users.noreply.github.com> Date: Sun, 8 Feb 2026 05:05:52 +0800 Subject: [PATCH] Fix escaping spaces in cookie value `urlencode` encodes space into `+`, which breaks `adminer_permanent`, which is space-separated. --- CHANGELOG.md | 1 + adminer/include/functions.inc.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 41b939f1..a442b0b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Hide sort links on unsortable columns - Display uneditable fields in edit form - Shorten all but numeric and date types in select +- Fix escaping spaces in cookie value - PostgreSQL: Offer foreign keys in create table - PostgreSQL: Add missing parentheses to CHECK export - PostgreSQL: Allow creating NOT DEFERRABLE foreign keys diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index 75859f7f..3177dcc3 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -334,7 +334,7 @@ function convert_fields(array $columns, array $fields, array $select = array()): */ function cookie(string $name, ?string $value, int $lifetime = 2592000): void { header( - "Set-Cookie: $name=" . urlencode($value) + "Set-Cookie: $name=" . rawurlencode($value) . ($lifetime ? "; expires=" . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT" : "") . "; path=" . preg_replace('~\?.*~', '', $_SERVER["REQUEST_URI"]) . (HTTPS ? "; secure" : "")