ID:               32406
 User updated by:  webmaster at benliles dot com
 Reported By:      webmaster at benliles dot com
-Status:           Bogus
+Status:           Open
 Bug Type:         Zend Engine 2 problem
 Operating System: *
 PHP Version:      5.*
 New Comment:

We are output buffering and in the destructor for a page class, we dump
the output buffer.  There is nothing in the documentation to indicate
when headers would be sent before this point.

Also, the headers_sent function is not reporting correct information. 
The file name is blank and line number is zero.


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

[2005-03-22 00:19:27] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

__destruct is called during script shut down - that is everything has
already been sent. Add a '$test = NULL;' in front of the '?>' and
you'll see.

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

[2005-03-22 00:16:31] webmaster at benliles dot com

Description:
------------
It appears that PHP has a flag set for headers already being sent when
__destruct() is called despite the fact that nothing is being sent
before that.  This has been seen in PHP 5.0.2 and PHP 5.0.3 with two
different operating systems.  This is not documented as claimed in an
earlier bug report.

Reproduce code:
---------------
<?
class letsTestThis {

 public function __destruct() {
  if (!headers_sent($file,$line)) {
   header("Content-type: text/xml");
   echo "Some cool XML!";
  } else {
   echo "Headers already sent in file: ".$file."<BR>\nOn Line:
".$line."<BR>\n";
  }
 }
}

$test = new letsTestThis();
?>

Expected result:
----------------
Some cool XML



Actual result:
--------------
Headers already sent in file: 
On Line: 0


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


-- 
Edit this bug report at http://bugs.php.net/?id=32406&edit=1

Reply via email to