Zend is buried about 3 directories deep in my LIBS directory which is not the base directory, so wheneve I include a Zend class and it has dependencies, most classes will explicitly include them with a include_once or require_once -- UGH!
Why this introduces a problem for me is two fold:
1. Whenever I include a Zend component I must now set the chdir() to the `Zend` directory first and restore when complete or whenever I need to work on files as well -- which thankfully is rare but this is still a PITA.
2. The class Zend_Mail_Transport_Smtp uses a method like class_exists to determine whether any dependencies need be included. However class_exists has an optional parameter which invokes autoload and it`s TRUE by default but looking at the code, it`s obvious this parameter should be set to false as the inclusion of dependencies is explicitly done immediately after.
Lines 190-193
Code: Select all
if (!class_exists($connectionClass)) {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($connectionClass);
}Code: Select all
if (!class_exists($connectionClass, false)) {
require_once 'Zend/Loader.php';
Zend_Loader::loadClass($connectionClass);
}Anyway, if this is not a credibe fix what would be the better solution. I assume it would be to implement a autoloader for Zend which introduces more problems, due to the fact my autoloaders will fail if they are ever invoked to handle a Zend_ class and visa-versa.
While the naming convention is identical, I have libraries stored in different base directories so I need a custom autoload to basically check the class prefix and set the base path. This works for my internal libraries but not for Zend, because Zend explicitly includes their dependencies using require_once, etc, so whenever the library is used it assumes everything is relative to it -- which is not the case unfortunately.
Suggestions, opinions, etc?
Cheers,
Alex