From: vesselin dot atanasov at gmail dot com Operating system: Fedora Core 8 PHP version: 5.2.6 PHP Bug Type: Session related Bug description: session_start() incorrectly tries to send a cookie
Description: ------------ session_start() incorrectly tries to send a cookie even when it has already been sent. This causes problems with sessions that are closed with session_write_close() some output has been sent and then the session is re-opened with session_start() The second time when session_start() is called it should avoid sending the cookie and cache headers, since they have already been sent by the first call to session_start(). It seems that the second time session_start() tries to send the same cookie value as the first time, so it should be possible to avoid sending that cookie a second time. Reproduce code: --------------- <?php session_start (); session_write_close (); print ("Test"); session_start (); ?> Expected result: ---------------- No output at all. Actual result: -------------- Test Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/medical/htdocs/try.php:4) in /var/medical/htdocs/try.php on line 5 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/medical/htdocs/try.php:4) in /var/medical/htdocs/try.php on line 5 -- Edit bug report at http://bugs.php.net/?id=45270&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45270&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45270&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45270&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45270&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45270&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45270&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45270&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45270&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45270&r=support Expected behavior: http://bugs.php.net/fix.php?id=45270&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45270&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45270&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45270&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45270&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45270&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45270&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45270&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45270&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45270&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45270&r=mysqlcfg