PHP try-catch blocks: are they able to catch invalid arg types?

Warnings and notices are not technically exceptions in PHP. To catch an exception it has to be explicitly thrown, and many of the built-in libraries of functions do not throw exceptions (mostly because they were written before PHP supported exceptions).

It would have been nice if somehow exceptions were built on top of the existing notice/warning/error framework but perhaps that is asking too much.

Leave a Comment