php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18035 session_destroy causes loss of output
Submitted: 2002-06-28 01:30 UTC Modified: 2002-07-01 19:48 UTC
From: warwick at imvs dot sa dot gov dot au Assigned:
Status: Closed Package: Session related
PHP Version: 4.2.0 OS: RedHat 7.2
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: warwick at imvs dot sa dot gov dot au
New email:
PHP Version: OS:

 

 [2002-06-28 01:30 UTC] warwick at imvs dot sa dot gov dot au
This problem occurs with PHP 4.2.0 and PHP 4.2.1 but is fine using PHP 4.1.1 and older versions.

When calling a session_destroy() on a newly created session, it will clear buffered output when greater than 4k without sending it to the client.

The following sample script should demonstrate this.  When $repeatCount is 4096 or greater, only the word END will be output, without the 4096 X's preceeding it.  When repeatCount is 4095 the X's and the word END are sent.

By removing the session_destroy() call following the str_repeat echo the X's will be output regardless of the $repeatCount setting.

<?php 
## Sample script
##
## Relevant (?) php.ini settings I have:
##  output_buffering = Off (have tried 8192 - no effect)
##  output_handler =
##  zlib.output_compression = Off
##  implicit_flush = Off

## $repeatCount = 4095; ## Works fine
$repeatCount = 4096;    ## Fails

session_start();
echo str_repeat('X', $repeatCount);
session_destroy();

echo "END";
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-28 02:03 UTC] sniper@php.net
I can't reproduce this..can you please try this
snapshot:

http://snaps.php.net/php4-latest.tar.gz
 [2002-07-01 19:48 UTC] warwick at imvs dot sa dot gov dot au
Thanks for your prompt response - I downloaded the CVS snapshot php4-200206272100 and it worked fine :)

Keep up the *great* work guys!
 [2002-07-15 09:25 UTC] moosh at phpFrance dot com
I can reproduce  with this.

Thats  works only the firstime when  session is not already a cookie.

note that  012345678910 is  break
----------------
<?php
session_start();
?>

<html>
<body>
<HR /> begin source <HR />
<?php
highlight_file("./".$PHP_SELF);
?>
<HR /> End source <HR />

<A href="blabla.php">blabla</A>

0 1 2 3 4 5

<?php session_destroy(); ?>

6 7 8 9 10


</body>
</html>
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 23:00:02 2026 UTC