Matt Wilson wrote:
> I agree, however there are certain aspects of PHP's errors that leave a
> lot to be desired. For instance, a failed fopen or a failed socket will
> often result in an uncatchable warning from php. Sure, you can add a @
> to the line but that's slow and doesn't tell you anything about what
> happened.
> 
> I've been saying for years that PHP needs to get over its perl phobia
> and implement something like $!
> 
> fopen("file", "r") or throw new Exception("Error: ". $!);
> 
> Wouldn't that be nice?

I don't see the big difference between that and:

if(!fopen("file", "r")) throw new Exception();

and error_get_last() gives you the type, error message, line number, and
filename which you can access in your catch block.  Presumably you still
want to log these which you get for free so no need for the @.

-Rasmus

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to