mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-26 11:37:33 +00:00
Merge remote-tracking branch 'bantu/task/fix-test-autoloader'
* bantu/task/fix-test-autoloader: [task/fix-test-autoloader] Fix autoloader to support failing/erroring tests.
This commit is contained in:
commit
d029b96148
@ -9,14 +9,34 @@
|
||||
// class files of phpseclib require() other dependencies.
|
||||
set_include_path(implode(PATH_SEPARATOR, array(
|
||||
dirname(__FILE__) . '/../phpseclib/',
|
||||
dirname(__FILE__) . '/',
|
||||
get_include_path(),
|
||||
)));
|
||||
|
||||
function phpseclib_is_includable($suffix)
|
||||
{
|
||||
foreach (explode(PATH_SEPARATOR, get_include_path()) as $prefix)
|
||||
{
|
||||
$ds = substr($prefix, -1) == DIRECTORY_SEPARATOR ? '' : DIRECTORY_SEPARATOR;
|
||||
$file = $prefix . $ds . $suffix;
|
||||
|
||||
if (file_exists($file))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function phpseclib_autoload($class)
|
||||
{
|
||||
$file = str_replace('_', '/', $class) . '.php';
|
||||
|
||||
if (phpseclib_is_includable($file))
|
||||
{
|
||||
require $file;
|
||||
}
|
||||
}
|
||||
|
||||
spl_autoload_register('phpseclib_autoload');
|
||||
|
Loading…
Reference in New Issue
Block a user