diff --git a/CAS.php b/CAS.php index 251f0236..f38e7b11 100644 --- a/CAS.php +++ b/CAS.php @@ -27,4 +27,6 @@ * @link https://wiki.jasig.org/display/CASC/phpCAS */ -require_once __DIR__.'/source/CAS.php'; \ No newline at end of file +require_once __DIR__.'/source/CAS.php'; + +trigger_error('Including CAS.php is deprecated. Install phpCAS using composer instead.', E_USER_DEPRECATED); diff --git a/composer.json b/composer.json index 15b39757..2b835d8e 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,11 @@ "source/" ] }, + "autoload-dev": { + "classmap": [ + "test/" + ] + }, "extra": { "branch-alias": { "dev-master": "1.3.x-dev" diff --git a/source/CAS/Autoload.php b/source/CAS/Autoload.php index 98847846..436f9de4 100644 --- a/source/CAS/Autoload.php +++ b/source/CAS/Autoload.php @@ -31,7 +31,7 @@ function CAS_autoload($class) } // Setup the include path if it's not already set from a previous call if (empty($include_path)) { - $include_path = array(dirname(__DIR__), dirname(__DIR__) . '/../test/' ); + $include_path = array(dirname(__DIR__)); } // Declare local variable to store the expected full path to the file @@ -73,10 +73,10 @@ function CAS_autoload($class) die ((string) $e); } -// set up __autoload -if (!(spl_autoload_functions()) - || !in_array('CAS_autoload', spl_autoload_functions()) -) { +// Set up autoload if not already configured by composer. +if (!class_exists('CAS_Client')) +{ + trigger_error('phpCAS autoloader is deprecated. Install phpCAS using composer instead.', E_USER_DEPRECATED); spl_autoload_register('CAS_autoload'); if (function_exists('__autoload') && !in_array('__autoload', spl_autoload_functions())