On 25/02/15 13:19, Rowan Collins wrote: >>> Tony, first of all - this still breaks BC, because exception is being >>> thrown in a place where it used not to be... >> >> I disagree. The following function calls would not throw exceptions >> fopen(...); >> fwrite(...); >> fclose(...); >> >> while the following code would: >> try { >> fopen(...); >> fwrite(...); >> fclose(...); >> } catch (....) { >> .... >> } > > But what about this code, which could well already exist: > > try { > $fh = fopen(...); > $this->processLotsOfDataAndMaybeThrowAnException($fh); > fclose($fh); > } catch (....) { > .... > } > > If fopen() starts throwing exceptions here, that's as much a BC break as > it throwing them everywhere. If it doesn't, the rules for when it should > throw become even more complicated, and useful in even fewer cases.
That is certainly the sort of scenario that I am concerned about. try/catch blocks have been added through a lot of libraries and if the returns now change then currently working code starts to fail. Fixing the extra exceptions looks more interesting, so referring to the first try block above, having to catch different exceptions from each function is the problem here. But I still prefer dealing with the error as part of the function call so I can at least respond in the same context. -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php