I discovered an interesting behavior, when ob_end_flush() or ob_end_clean() is used in a destructor of an object.
I don't think it is actually a bug, so i decided to post it here.


<?php
class foo
{
    public function __construct()
    {
        ob_start();
    }
    public function __desctruct()
    {
        ob_end_flush();
    }
}

$f = new foo();
// end of file
?>

this ends in an error:
Notice: ob_end_flush(): failed to delete buffer. No buffer to delete. in ...

but this functions very well.

<?php
// with the same class foo
$f = new foo();
unset($f);
// end of file
?>

it seems that php first ends output buffering and then calls then destrcuts the objects. so the output buffering is still ended when the destructor is calles. one has to unset the object to reverse that order manually.

aRZed

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to