Bug #79174 [Asn->Csd]: setcookie() encodes space as `+`, but $_COOKIE no longer decodes them
| From: | cmb@php.net | Date: | Tue, 28 Jan 2020 14:38:41 +0000 |
| Subject: | Bug #79174 [Asn->Csd]: setcookie() encodes space as `+`, but $_COOKIE no longer decodes them | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-225194@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79174&edit=1
ID: 79174
Updated by: cmb@php.net
Reported by: bjorsch at wikimedia dot org
Summary: setcookie() encodes space as
+, but $_COOKIE no
longer decodes them
-Status: Assigned
+Status: Closed
Type: Bug
Package: URL related
Operating System: Irrelevant
PHP Version: 7.4.2
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of cmbecker69@gmx.de
Revision: http://git.php.net/?p=php-src.git;a=commit;h=addc3c92f2956b4efea9d78f34262403adc393ad
Log: Fix #79174: cookie values with spaces fail to round-trip
Previous Comments:
------------------------------------------------------------------------
[2020-01-28 14:30:57] cmb@php.net
Related To: Bug #78929
------------------------------------------------------------------------
[2020-01-27 15:14:29] bjorsch at wikimedia dot org
Description:
------------
http://git.php.net/?p=php-src.git;a=commit;h=79376ab209f61be03bbf8c1b6177c18261767da8
fixed #78929 by changing the cookie decoding logic to use php_raw_url_decode() rather than
php_url_decode(). Unfortunately, it didn't change php_setcookie() to match.
This results in cookie values with spaces failing to round-trip.
Test script:
---------------
You already have a test illustrating this behavior at https://git.php.net/?p=php-src.git;a=blob;f=ext/standard/tests/network/setcookie.phpt;h=d41bed01f4e9e3866817ef9e3c6aff10dd575ed5;hb=79376ab209f61be03bbf8c1b6177c18261767da8
See lines 10 and 27.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79174&edit=1