ID:               32414
 Updated by:       [EMAIL PROTECTED]
 Reported By:      d dot geels at grape dot ru
 Status:           Open
-Bug Type:         Session related
+Bug Type:         Documentation problem
 Operating System: any
 PHP Version:      4.3.10, also 5
 New Comment:

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.
 


Previous Comments:
------------------------------------------------------------------------

[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.

------------------------------------------------------------------------

[2005-03-22 18:43:53] d dot geels at grape dot ru

No, we don't use this at all, this option is always set to 0. 
Just checked, ini option is set to 0, .htaccess doesn't change this
option.

------------------------------------------------------------------------

[2005-03-22 18:34:23] [EMAIL PROTECTED]

Do you have 'session.auto_start' set on somewhere?
(httpd.conf, .htaccess file, php.ini..) 

------------------------------------------------------------------------

[2005-03-22 18:25:12] d dot geels at grape dot ru

There is one more detail, I forgot to mention:
I couldn't kill warning message by calling @start_session() in line 45.
Is this because of warning message issued somewhere in calls from
session_start()?

------------------------------------------------------------------------

[2005-03-22 18:16:04] d dot geels at grape dot ru

Just viewd latest session.c from CVS repository. There are not much
changes between versions 4 and 5, so bug still remains in PHP 5.

Somewhere here:
static int php_session_cache_limiter(TSRMLS_D)
{
        php_session_cache_limiter_t *lim;

// for some reason, this string fails
        if (PS(cache_limiter)[0] == '\0') return 0;
// I cant understand all this file, but I think, problem is
// that value 'none' is not properly recognized or processed

        
        if (SG(headers_sent)) {
                char *output_start_filename =
php_get_output_start_filename(TSRMLS_C);
                int output_start_lineno = php_get_output_start_lineno(TSRMLS_C);

                if (output_start_filename) {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot 
send session
cache limiter - headers already sent (output started at %s:%d)",
                                output_start_filename, output_start_lineno);
                } else {
                        php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot 
send session
cache limiter - headers already sent");
                }       
                return -2;
        }
        
        for (lim = php_session_cache_limiters; lim->name; lim++) {
                if (!strcasecmp(lim->name, PS(cache_limiter))) {
                        lim->func(TSRMLS_C);
                        return 0;
                }
        }

        return -1;
}

------------------------------------------------------------------------

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

Reply via email to