Does PHP autoloading work with Exception classes?

I've noticed a lot of frameworks and SKDs are very good about calling required_once() to load a custom exception class before actually throwing the exception, which begs the question, "Can't autoloading take care of that?" I did a little investigating, and the answer is: A little yes; a little no.

Exception Classes Do Get Autoloaded

Yes. Exception classes will get autoloaded when they're thrown:

function autoload($classname)
 echo "autoload called\n";
 class MyException extends Exception{}


try {
 echo "throwing exception\n";
 throw new MyException();
 catch (MyException $ex) {
 echo "exception caught\n";

The previous code will output:

throwing exception
autoload called
exception caught

So exception classes will indeed be autoloaded. So why do major frameworks (e.g. Zend) and SDKs (e.g. Amazon) always include a require_once() call to ensure the class is loaded? Because there's no guarantee the autoloading mechanism is their own.

The Zend Framework loves using its own autoloading classes, but it's designed to be used in pieces and cannot be certain (1) any autoloading will actually be enabled or (2) the autoloading that is enabled will know where to find its exception classes (they're PSR-0 compliant, but still . . .).

So what's best practice?

In my opinion, you can feel free to rely on autoloading whenever you will always control the environment your code executes in. Otherwise, don't rely on autoloading (and that goes for all classes, not just custom exceptions).

What do you think?