php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
34 - 15 = ?
Subscribe to this entry?

 
 [2012-05-15 16:11 UTC] laurent dot perez at backelite dot com
Description:
------------
Hi

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
print_r($_COOKIE);
?> 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-05-15 18:43 UTC] sixd@php.net
-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] sixd@php.net
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 http://www.php.net/downloads.php

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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 23:01:29 2024 UTC