Tony Marston wrote on 16/02/2015 10:09:
This RFC only mentions errors with object methods, so what impact would it have with procedural functions. For example, if fopen('nonexistantfile.txt') fails the return value is FALSE and an E_WARNING is generated, but it is difficult to trap the error message (it could be a permissions error, for example). Is there any plan to convert procedural functions to throw exceptions?
As Nikita already said:
This RFC is strictly about fatal and recoverable fatal errors. Changing any other error types to exceptions would be a significant backwards-compatibility break.
So, no, since that's currently an E_WARNING, there is no current plan to change that case to an exception. If we were writing fopen() from scratch now, it might be worth considering, but the BC implications of changing something from non-fatal to fatal are rather drastic.
That has absolutely nothing to do with OO vs procedural code, though. A procedural function could well have an error condition which should be fatal if unhandled, but can usefully be caught somewhere up the stack, which is basically what an exception is for. Any procedural function which currently issues an E_ERROR or E_RECOVERABLE_ERROR is a candidate to be converted under the current RFC.
Regards, -- Rowan Collins [IMSoP] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php