Exceptions for all PHP Errors

I don't remember actually using this for quite some time now. For all I know, somewhere along the line they've fixed this inside the PHP run-time system.

PHP has many issues with backward compatibility. It traces it's lineage back to a simple templating engine and over the years has gained many features to try and turn it into a multi-paradigm programming language. All this whilst trying to maintain full backward compatibility.

Something has got to break.

One element of this backward compatibility is that some errors don't throw handleable exceptions instead they rely on an older mechanism that takes me back to my days of programming in BASIC (that's a long, long, long, long time ago).

And even if we wrap all this up in a nice "modern" lambda function, it's still hard to deal with the errors:

But this error handling mechanism does give us a simple way to generate exceptions that can be handled with catch.


More stuff to read