From:             matthias dot heller at gmx dot net
Operating system: Debian Linux 3.1
PHP version:      4.3.9RC3
PHP Bug Type:     Session related
Bug description:  Set-Cookie HTTP-Header is missing using session_start()

Description:
------------
This bug occures in php-4.3.9 final release
my configure command:
'./configure' '--with-mysql' '--with-apxs2=/usr/bin/apxs2'
'--enable-bcmath' '--enable-calendar' '--with-zlib' '--enable-sockets'

The only change in php.ini:

session.cookie_name = PHPSESSID
changed to
session.cookie_name = GWARS_COOKIE

The HTTP-Header Set-Cookie is only send when no session-cookie was send in
the HTTP_REQUEST to the server (Apache 2.0.51).
So when I delete my cookies and I call the script for the first time I got
in my HTTP headers the following line:

Set-Cookie: GWARS_COOKIE=<SESSION_ID>; expires=<DATE>; path=/

when I call the same page again the Set-Cookie line in the HTTP headers is
missing.

The Set-Cookie line in the HTTP headers will occure after I delete my
cookies. So the problem is, that my session will be invalid after 30
minutes even if session_start is called again, as I don't get a new
Set-Cookie line with the new expiry-date

My browser accept cookies and the script worked fine with php version
4.3.8 same configure command and same php settings.

Hopefully you understand my problem. If not please contact me.

Reproduce code:
---------------
<?php
session_start();
?>

My work around is

<?php
session_start();
if (isset($_COOKIE['GWARS_COOKIE']))
{
    setcookie('GWARS_COOKIE' , $_COOKIE['GWARS_COOKIE'] , time() + 1800);
}//endif
?>

Expected result:
----------------
The code should return an empty page. That works quite fine.
But the HTTP Headers are only correct the first time I call the script.
When I call the script more often and my session-cookie is valid the
response HTTP headers are incorrect (Set-Cookie ... is missing)

Actual result:
--------------
First time call of script:

HTTP-Return

    HTTP/1.1 200 OK\r\n
    Date: Sat, 25 Sep 2004 20:16:19 GMT\r\n
    Server: Apache/2.0.51 (Debian GNU/Linux) mod_perl/1.99_12 Perl/v5.8.3
PHP/4.3.9\r\n
    X-Powered-By: PHP/4.3.9\r\n
    Set-Cookie: GWARS_COOKIE=f94b066ef5acdeefb4bcce83292c661b;
expires=Sat, 25-Sep-2004 20:46:19 GMT; path=/\r\n
    Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\n
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0\r\n
    Pragma: no-cache\r\n
    Content-Length: 4\r\n
    Keep-Alive: timeout=2, max=100\r\n
    Connection: Keep-Alive\r\n
    Content-Type: text/html; charset=ISO-8859-1\r\n
    \r\n

second call of script (cache emptied)

    HTTP/1.1 200 OK\r\n
    Date: Sat, 25 Sep 2004 20:16:19 GMT\r\n
    Server: Apache/2.0.51 (Debian GNU/Linux) mod_perl/1.99_12 Perl/v5.8.3
PHP/4.3.9\r\n
    X-Powered-By: PHP/4.3.9\r\n
    Expires: Thu, 19 Nov 1981 08:52:00 GMT\r\n
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0,
pre-check=0\r\n
    Pragma: no-cache\r\n
    Content-Length: 4\r\n
    Keep-Alive: timeout=2, max=100\r\n
    Connection: Keep-Alive\r\n
    Content-Type: text/html; charset=ISO-8859-1\r\n
    \r\n


-- 
Edit bug report at http://bugs.php.net/?id=30232&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=30232&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30232&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30232&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=30232&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=30232&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=30232&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=30232&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=30232&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=30232&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=30232&r=notwrong
Not enough info:             http://bugs.php.net/fix.php?id=30232&r=notenoughinfo
Submitted twice:             http://bugs.php.net/fix.php?id=30232&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=30232&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=30232&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=30232&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=30232&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=30232&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=30232&r=float
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=30232&r=mysqlcfg

Reply via email to