|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62039 When multiple cookies are received, $Version=0 is badly concatened
Submitted: 2012-05-15 16:11 UTC Modified: 2012-05-16 08:00 UTC
From: laurent dot perez at backelite dot com Assigned:
Status: Not a bug Package: HTTP related
PHP Version: PHP 5.4.1-1~oneiric+1 OS: Linux
Private report: No CVE-ID: None
 [2012-05-15 16:11 UTC] laurent dot perez at backelite dot com

I'm sending the following cookies to a PHP 5.3.6-13ubuntu3.7 page :

>> "Cookie: $Version=0; applicookie=monappli[\r][\n]"
>> "Cookie: $Version=0; monautrecookie=autrevaleur[\r][\n]"

When I dump them using print_r($_COOKIE);, the value of the first one (applicookie) gets concatenated with a comma plus $Version=0 string :

<< "    [applicookie] => monappli, $Version=0[\n]"
<< "    [monautrecookie] => autrevaleur[\n]"

It looks like a concatenation bug. The value of applicookie should not be modified.

Test script:
Get Firebug, install Firecookie, forge two cookies as HttpOnly, send them, <?php
?> will display a wrong value for the first one received.

Expected result:
Unmodified cookie values

Actual result:
The first cookie value gets concatenated with comma + $Version=0 string


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-15 18:43 UTC]
-Status: Open +Status: Not a bug -Operating System: PHP 5.3.6-13ubuntu3.7 +Operating System: Linux -PHP Version: master-Git-2012-05-15 (Git) +PHP Version: PHP 5.3.6-13ubuntu3.7
 [2012-05-15 18:43 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

Please reopen if it occurs in a recent version of PHP.
 [2012-05-16 08:00 UTC] laurent dot perez at backelite dot com
-PHP Version: PHP 5.3.6-13ubuntu3.7 +PHP Version: PHP 5.4.1-1~oneiric+1
 [2012-05-16 08:00 UTC] laurent dot perez at backelite dot com
Still happening with PHP 5.4.1-1~oneiric+1
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Jul 30 14:01:24 2021 UTC