On 21-10-19 18:02, Rowan Tommins wrote: > There is no general way to know whether the result of aborting execution > completely is better or worse than carrying on with unexpected values. In a > program that's not expecting it, either one could lead to data loss or > corruption.
I would guess that carrying on with unexpected values is worse because it happens more often. Checking for false or null is something that everybody forgets all the time. Exceptions are more explicit and an IDE will point you at places in your code where you forgot to either handle or delegate them. > There are definitely places where a Warning can reasonably be converted to > an Exception; but I don't think this should be done as some kind of bulk > change. Each Warning we promote should have at least one person answer the > question "is it likely that terminating processing when this happens at > run-time will be better than flagging a Warning and returning a defined > value?" I fully agree. However I think the fear of having to add tons of try / catch to existing code is exaggerated. I use Python a lot, which is quite an exception throwing machine in comparison. Still, my code is not cluttered with exception handling. So, converting a ton of warnings to exceptions in PHP does not worry me at all. I would welcome it, but not as a bulk operation. I agree that we need to ask the question for each case. I would still prefer the answers to bias towards exceptions though. Regards, Dik Takken -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php