Fix escaping spaces in cookie value

`urlencode` encodes space into `+`, which breaks `adminer_permanent`, which is space-separated.
This commit is contained in:
Shun Zi
2026-02-08 05:05:52 +08:00
committed by Jakub Vrana
parent 5b9f0186a8
commit b827340dee
2 changed files with 2 additions and 1 deletions

View File

@@ -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

View File

@@ -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" : "")