Bug #78207 [NEW]: setrawcookie does not not behave like setcookie when overwriting
| From: | nico at billiotte dot fr | Date: | Tue, 25 Jun 2019 15:12:25 +0000 |
| Subject: | Bug #78207 [NEW]: setrawcookie does not not behave like setcookie when overwriting | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-221481@lists.php.net to get a copy of this message | ||
From: nico at billiotte dot fr
Operating system: OSX + linux
PHP version: 7.3.6
Package: Unknown/Other Function
Bug Type: Bug
Bug description:setrawcookie does not not behave like setcookie when overwriting
Description:
------------
---
From manual page: https://php.net/function.setrawcookie
---
Test script:
---------------
$id = $_REQUEST['id'];
$val = $_REQUEST['val'];
if( isset($_COOKIE['testcookie']) ){
$cookie = json_decode($_COOKIE['testcookie'], true);
}
$moncookie[$id] = $val;
setrawcookie('testcookie', json_encode($cookie), 0, '/');
Expected result:
----------------
send id = 1 & val = "foo"
cookie = {1:foo} -> correct
then resend id = 2 & val = "bar"
cookie should contain {1:foo, 2:bar}
Actual result:
--------------
the cookie remains nothing changes
{1:foo} -> not correct
change setrawcookie by setcookie and add urldecode() and everything is
fine you can "update" the cookie
--
Edit bug report at https://bugs.php.net/bug.php?id=78207&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78207&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78207&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78207&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=78207&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78207&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78207&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78207&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78207&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78207&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78207&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78207&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78207&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78207&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78207&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=78207&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78207&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78207&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78207&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78207&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78207&r=mysqlcfg