#32414 [Csd]: session_start(): Cannot send session cache limiter

From: Date: Wed, 23 Mar 2005 11:35:54 +0000
Subject: #32414 [Csd]: session_start(): Cannot send session cache limiter
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969367762@lists.php.net to get a copy of this message
ID: 32414 Updated by: tony2001@php.net Reported By: d dot geels at grape dot ru Status: Closed -Bug Type: Session related +Bug Type: Documentation problem Operating System: any PHP Version: 4.3.10, also 5 New Comment: Nope. Use ini_set('session.use_cookies', false); to turn off cookie sending and session_cache_limiter(''); to not use ANY cache limiter, because 'none' is being sent too. Please, do not reclassify existing and already closed bugs, fill a new report if you feel that there is *really* a bug. For further questions please use support forums and mailing lists. Previous Comments: ------------------------------------------------------------------------ [2005-03-23 12:08:27] d dot geels at grape dot ru No, you misunderstood me: I want to say, that problem is that session_start() ALWAYS tries to send headers. Even if all reasons for sending are eliminated by ini_set('session.use_cookies', 0) and session_cache_limiter('none'), it still tries to send empty headers, which cause bug subject warning. ------------------------------------------------------------------------ [2005-03-23 11:43:40] vrana@php.net This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. "Shutdown function is called during the script shutdown so headers are always already sent." ------------------------------------------------------------------------ [2005-03-23 01:10:03] d dot geels at grape dot ru The problem is that session_start() tries to send headers, but it must not. Try 'curl -v <url to above example>' and just call function a() at the end, without registering shutdown function, you'll see, that session_start() doesn't send any headers if second call to session_cache_limiter has parameter 'none'. So, why does it complain, when called from shutdown function? That is the bug actually. ------------------------------------------------------------------------ [2005-03-22 22:56:05] sniper@php.net This is actually just documentation problem: You can't send any headers from a register_shutdown_function() call. Or use any functions in such function that might send headers..such as almost any session function. ------------------------------------------------------------------------ [2005-03-22 18:46:42] d dot geels at grape dot ru Tiny example, that always reproduces the bug. <? ini_set('session.use_cookies', 0); session_id('1234'); session_cache_limiter('public'); session_start(); session_write_close(); ?> text <? function a(){ session_cache_limiter('none'); session_start(); session_write_close(); } register_shutdown_function('a'); ?> If just call a() at the end -- no warnings, if a() called at shutdown -- warning issued. ------------------------------------------------------------------------ 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 http://bugs.php.net/32414 -- Edit this bug report at http://bugs.php.net/?id=32414&edit=1

« previous php.doc (#969367762) next »