Hi all

[PHP5] I am in progress of writing a session class and i want to use a
try / throw / catch scheme for setting headers. I tried to suppress
the warning and check if the function returns false and then throw my
custom logging exception, but unfortunaly it looks like header returns
void.

Any ideas how i can properly throw an exception if header() fails ?

Here is what i have:

   private function set_header($value, $replace=null,
$http_response_code=null)
   {
        if([EMAIL PROTECTED]($value, $replace, $http_response_code))
        {
                throw new LogException('Headers already sent: '.$value,
'SessionClass');
        }
   }

   private function send_no_cache_header()
   {
        try
        {
                $time = time() - 60000;
                
                $this->setHeader("Expires: ".date('D, d M Y H:i:s', $time)." 
GMT");
        $this->setHeader("Last-Modified: " . gmdate("D, d M Y H:i:s")
. " GMT");
        $this->setHeader("Cache-Control: no-cache, must-revalidate");
        $this->setHeader("Pragma: no-cache");
        $this->setHeader("Cache-Control: post-check=0, pre-check=0");
        }
        catch(LogException $e) { return false; }
   }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to