Class ... Not Found Issue
Posted on 2009-03-04 (Updated on 2019-01-24)
I ran into a very sticky issue while writing a very complex set of PHP classes: I continually ran into the "Class '[ClassName]' not found" error, even though the classes were clearly defined – sometimes even in the same file. This drove me nuts for hours.
I did some digging into the PHP class documentation, and it turns out that you cannot extend extended classes in PHP, and instead of giving you a helpful error message, it just says that the class cannot be found.
As an example, if you have a BaseClass class, and another class that's defined using NewClass extends BaseClass, you cannot then say ExtendedNewClass extends NewClass: that will throw a "Class 'ExtendedNewClass' not found" error.
I don't think I've found the bottom of this problem, so I'll continue adding any new information that I find.
Tags: php