From: marcos dot neves at gmail dot com Operating system: ANY PHP version: 5.2.0 PHP Bug Type: Feature/Change Request Bug description: Error to Exception configuration
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 bug report at http://bugs.php.net/?id=39510&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39510&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39510&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39510&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39510&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39510&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39510&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=39510&r=needscript Try newer version: http://bugs.php.net/fix.php?id=39510&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39510&r=support Expected behavior: http://bugs.php.net/fix.php?id=39510&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39510&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39510&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39510&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39510&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39510&r=dst IIS Stability: http://bugs.php.net/fix.php?id=39510&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39510&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39510&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39510&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=39510&r=mysqlcfg