On 4 Apr 2008, at 03:05, hutchic wrote:
> Lee: Not so much auditing although an interesting idea as well.
> Basically I was looking to catch and log all fatal errors however it's
> occured to me that this will not work.
>
> We end up with fatal errors in our application (no body's fault but
> our own) by attempting to use a method on a null.  For example:
>
> $user = UsersPeer::doSelectOne(new Criteria());
> $user->getId();


create a custom error handler that throws an exception instead of an  
error then (and deal with the exception however you want).

I've got this on my todo list, but never seem to have the time to get  
round to it.

Ofcourse, you could also check for the presence of the object (which  
makes more sense to me)

if (!$user = UsersPeer::doSelectOne(new Criteria()))
   throw new sfException('doh!);
$user->getId();

> catchFatal($object, $method){
>    if(method_exists($object,$method) && is_callable()){
>        return call_user_func(...);
>    }else{
>        /** log enough information to track where to solve this error
> and 404 the page **/
>    }
> }

Use the above but with forward404unless 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to