Edit report at https://bugs.php.net/bug.php?id=63835&edit=1

 ID:                 63835
 Updated by:         larue...@php.net
 Reported by:        tom916 at qq dot com
 Summary:            two cookie in request ,get comma in first cookie
                     name
 Status:             Open
 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:

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.


Previous Comments:
------------------------------------------------------------------------
[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

Reply via email to