|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-05-22 17:39 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 05:00:01 2025 UTC |
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.