From:             bonebreaker at free dot fr
Operating system: Windows XP
PHP version:      5.0.0RC2
PHP Bug Type:     Class/Object related
Bug description:  Destructor sending headers?

Description:
------------
__destruct() appears to be automatically sending headers before it's ran.

Output buffering can't prevent this behaviour.

Tested on Windows XP, Apache 2.0.48

Reproduce code:
---------------
class Test {
    function __construct()
    {
        $this->_string = '__construct()<br />';
    }

    function __destruct()
    {
        if (headers_sent($file, $line)) {
            $this->_string .= 'Headers sent in ' . $file . ' on line ' .
$line;
        } else {
            $this->_string .= '__destruct()';
        }
        print $this->_string;
    }
}

$test = new Test();

Expected result:
----------------
__construct()
__destruct()

Actual result:
--------------
__construct()
Headers sent in on line 0


Though headers_sent() returns true, $file and $line still have default
values.

-- 
Edit bug report at http://bugs.php.net/?id=28489&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=28489&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=28489&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=28489&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=28489&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=28489&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=28489&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=28489&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=28489&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=28489&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=28489&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=28489&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=28489&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28489&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=28489&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=28489&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=28489&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28489&r=float

Reply via email to