ID: 39510 Updated by: [EMAIL PROTECTED] Reported By: marcos dot neves at gmail dot com -Status: Open +Status: Wont fix Bug Type: Feature/Change Request Operating System: ANY PHP Version: 5.2.0 New Comment:
This is something you can already do by just creating your own user defined error handler (with set_error_handler). Previous Comments: ------------------------------------------------------------------------ [2006-11-14 13:11:54] marcos dot neves at gmail dot com Description: ------------ A nice feature would be a php.ini configuration with access PHP_INI_ALL and with the name error_to_exception configured by following way: ini_set("error_to_exception", E_ALL); or in php.ini: error_to_exception = E_WARNING | E_FATAL The behavior would be that php error messages, would be converted to Exceptions. PHP could slowly create specific exception like, FileNotFoundException that is throw only when error_to_exception is enabled. Would be possible to do the follow code: Reproduce code: --------------- <? ini_set("error_to_exception", E_ALL); try { $contents = file_get_contents("path/to/file"); }catch(WarningException $e){ ... } ?> And on the future: <? ini_set("error_to_exception", E_ALL); try { $contents = file_get_contents("path/to/file"); }catch(FileNotFoundException $e){ ... }catch(FileNotReadableException $e) { ... } ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39510&edit=1