Edit report at https://bugs.php.net/bug.php?id=63835&edit=1
ID: 63835
Updated by: laruence@php.net
Reported by: tom916 at qq dot com
Summary: two cookie in request ,get comma in first cookie
name
Status: Assigned
Type: Bug
Package: *General Issues
Operating System: linux
PHP Version: 5.3Git-2012-12-22 (Git)
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
I have no idea why some browser will do this, but I can not find a proof that
doesn't allow this.
anyway, this fix will introduce bc break, like, before,
cookie: userids=123,1232,123213;
I saw such usage before, so... I didn't commit this. I will try to find some
fix in the apache apis
Previous Comments:
------------------------------------------------------------------------
[2012-12-23 08:52:49] tom916 at qq dot com
Now if the cookie name has a comma ,It becomes 2 cookie name
<?php
$fp = fsockopen("localhost", 50080, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET /show_cookie.php HTTP/1.1\r\n";
$out .= "Host: localhost:50080\r\n";
// $out .= "Cookie:\r\n";
$out .= "Cookie: a=1; b=2; c,d=abc\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
echo fgets($fp, 128);
}
fclose($fp);
}
----------------------------
Array
(
[a] => 1
[b] => 2
[c] =>
[d] => abc
)
------------------------------------------------------------------------
[2012-12-23 08:05:40] tom916 at qq dot com
Thank you very much to help me solve the problem in such a short time. Do you know why the browser
will send the cookie header? Our website every day will receive nearly 10,000 such requests.
------------------------------------------------------------------------
[2012-12-23 06:04:14] laruence@php.net
The following patch has been added/updated:
Patch Name: bug63835.patch
Revision: 1356242654
URL: https://bugs.php.net/patch-display.php?bug=63835&patch=bug63835.patch&revision=1356242654
------------------------------------------------------------------------
[2012-12-23 05:48:53] laruence@php.net
oh, ignore my previous comment, apache return a comma separated string if there is
multi cookie headers
------------------------------------------------------------------------
[2012-12-23 05:46:39] laruence@php.net
I don't think it's a php specific bug, php read the cookie via apache
apr_table_get
apr_table_get return ", a=1" in your case.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=63835
--
Edit this bug report at https://bugs.php.net/bug.php?id=63835&edit=1