Я использовал следующий код для использования spl_autoload_register таким образом, что он будет ухудшаться, если его нет, а также для работы с библиотеками, использующими __autoload, которые вам необходимо включить.
//check to see if there is an existing __autoload function from another library
if(!function_exists('__autoload')) {
if(function_exists('spl_autoload_register')) {
//we have SPL, so register the autoload function
spl_autoload_register('my_autoload_function');
} else {
//if there isn't, we don't need to worry about using the stack,
//we can just register our own autoloader
function __autoload($class_name) {
my_autoload_function($class_name);
}
}
} else {
//ok, so there is an existing __autoload function, we need to use a stack
//if SPL is installed, we can use spl_autoload_register,
//if there isn't, then we can't do anything about it, and
//will have to die
if(function_exists('spl_autoload_register')) {
//we have SPL, so register both the
//original __autoload from the external app,
//because the original will get overwritten by the stack,
//plus our own
spl_autoload_register('__autoload');
spl_autoload_register('my_autoload_function');
} else {
exit;
}
}
Итак, этот код проверит существующую функцию __autoload и добавит ее в стек, а также вашу собственную (поскольку spl_autoload_register отключит нормальное поведение __autoload).