Skip to content
Snippets Groups Projects
Commit 057c7c46 authored by Olav Morken's avatar Olav Morken
Browse files

Autoloader: Added backwards-compatibility for PHP versions without spl_autoload_register.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@611 44740490-163a-0410-bde0-09ae8108e29a
parent 0d7656e1
No related branches found
No related tags found
No related merge requests found
...@@ -33,7 +33,24 @@ function SimpleSAML_autoload($className) { ...@@ -33,7 +33,24 @@ function SimpleSAML_autoload($className) {
} }
} }
/* Register autload function for simpleSAMLphp. */ /* Register autoload function for simpleSAMLphp. */
spl_autoload_register('SimpleSAML_autoload'); if(function_exists('spl_autoload_register')) {
/* Use the spl_autoload_register function if it is available. It should be available
* for PHP versions >= 5.1.2.
*/
spl_autoload_register('SimpleSAML_autoload');
} else {
/* spl_autoload_register is unavailable - let us hope that no one else uses the __autoload function. */
/**
* Autoload function for those who don't have spl_autoload_register.
*
* @param $className The name of the requested class.
*/
function __autoload($className) {
SimpleSAML_autoload($className);
}
}
?> ?>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment