Edit report at https://bugs.php.net/bug.php?id=63835&edit=1
ID: 63835 User updated by: tom916 at qq dot com Reported by: tom916 at qq dot com Summary: two cookie in request ,get comma in first cookie name -Status: Closed +Status: Assigned Type: Bug Package: *General Issues Operating System: linux PHP Version: 5.3Git-2012-12-22 (Git) Block user comment: N Private report: N New Comment: 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 ) Previous Comments: ------------------------------------------------------------------------ [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] larue...@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] larue...@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] larue...@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. ------------------------------------------------------------------------ [2012-12-22 17:21:20] tom916 at qq dot com Description: ------------ When the browser client send 2 Cookie: in headerï¼the php get first cookie name has a comma in the fist charãGod know know the browser send 2 Cookie in header ? Array ( [,_a] => 1 ) Test script: --------------- ------------------show_cookie.php-------------- <?php print_r($_COOKIE); ------------------send_cookie.php-------------- <?php $fp = fsockopen("localhost", 50080, $errno, $errstr, 30); //my apache listen on 50080 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\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($fp); } php send_cookie.php ---------result----------- HTTP/1.1 200 OK Date: Sat, 22 Dec 2012 17:11:59 GMT Server: Apache/2.2.17 (Unix) PHP/5.3.3 X-Powered-By: PHP/5.3.3 Content-Length: 25 Connection: close Content-Type: text/html Array ( [,_a] => 1 ) Expected result: ---------------- Array ( [a] => 1 ) Actual result: -------------- Array ( [,_a] => 1 ) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63835&edit=1