Bug #79174 [NEW]: setcookie() encodes space as `+`, but $_COOKIE no longer decodes them
| From: | bjorsch at wikimedia dot org | Date: | Mon, 27 Jan 2020 15:14:29 +0000 |
| Subject: | Bug #79174 [NEW]: setcookie() encodes space as `+`, but $_COOKIE no longer decodes them | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-225153@lists.php.net to get a copy of this message | ||
From: bjorsch at wikimedia dot org
Operating system: Irrelevant
PHP version: 7.4.2
Package: URL related
Bug Type: Bug
Bug description:setcookie() encodes space as
+, but $_COOKIE no longer decodes them
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 bug report at https://bugs.php.net/bug.php?id=79174&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79174&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79174&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79174&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79174&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79174&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79174&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79174&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79174&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79174&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79174&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79174&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79174&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79174&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79174&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79174&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79174&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79174&r=mysqlcfg