quirky destructors
Posted: Thu Aug 02, 2007 3:59 pm
I'm having some issues with destructors not firing in a place where that isn't an option. I placed some code in the destructor that would send me an email message and not even that is being received.
Code: Select all
public function __destruct()
{
//if ($this->is_saved) { return; }
ob_start();
// re-sort the messages??
$this->all_mail['messages'] = ($this->reSort) ? array_multi_sort_desc($this->all_mail['messages'], 'fpost') : $this->all_mail['messages'];
// reset the array keys..
$this->all_mail['messages'] = array_merge($this->all_mail['messages']);
// reindex the note_id's..
$this->create_indexes();
// save to memcache for 8 minutes..
$this->sCache->storeEntry('MAIL_INBOX' . $this->user_id, $this->all_mail, (self::CACHE_TIMEOUT * 60));
$contents = ob_get_contents();
ob_end_clean();
$headers = array('From: xxx@xxx.com',
'Reply-To: xxx@xxx.com',
'Return-Path: xxx@xxx.com');
mail('xxx@xxx.com', 'DEBUG DATA ' . date("G:i:s"), $contents, implode("\r\n", $headers));
}