On some operating systems using DirectoryIterator does not keep the files in alphabetical order. Therefore when installing an extension such as the "Database" extension the files are written out with QueryCached.php before Query.php. Since QueryCached depends on Query it causes a fatal error.
This can be solved in a few ways.
Adding include/require statements at the top of the files that have dependencies to include their dependencies.
On extension install resolve class dependencies and reorder the files in the correct order in extensions/installed.json.
Sort the array in alphabetical order in the application when Sonic\App::loadExtension() is called.
Option 1 is probably the simplest to implement, but option 2 seems to make the most sense.
This is a temporary fix, but I confirmed that it works with all current extensions. When extensions can be loaded using a single Core file then this will no longer be an issue anyway other than for development.
On some operating systems using DirectoryIterator does not keep the files in alphabetical order. Therefore when installing an extension such as the "Database" extension the files are written out with QueryCached.php before Query.php. Since QueryCached depends on Query it causes a fatal error.
This can be solved in a few ways.
Option 1 is probably the simplest to implement, but option 2 seems to make the most sense.