|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-11-14 14:45 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 21 08:00:02 2025 UTC |
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) { ... } ?>