Switch autoloader from '__autoload' magic function name to registering our function with spl_autoload_register(); fixes compat problem with PHPUnit 3.5+ which seems to break the old __autoload
This commit is contained in:
parent
946a4ac17b
commit
f5650806cc
@ -95,7 +95,11 @@ function _have_config()
|
|||||||
return StatusNet::haveConfig();
|
return StatusNet::haveConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
function __autoload($cls)
|
/**
|
||||||
|
* Wrapper for class autoloaders.
|
||||||
|
* This used to be the special function name __autoload(), but that causes bugs with PHPUnit 3.5+
|
||||||
|
*/
|
||||||
|
function autoload_sn($cls)
|
||||||
{
|
{
|
||||||
if (file_exists(INSTALLDIR.'/classes/' . $cls . '.php')) {
|
if (file_exists(INSTALLDIR.'/classes/' . $cls . '.php')) {
|
||||||
require_once(INSTALLDIR.'/classes/' . $cls . '.php');
|
require_once(INSTALLDIR.'/classes/' . $cls . '.php');
|
||||||
@ -111,6 +115,8 @@ function __autoload($cls)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spl_autoload_register('autoload_sn');
|
||||||
|
|
||||||
// XXX: how many of these could be auto-loaded on use?
|
// XXX: how many of these could be auto-loaded on use?
|
||||||
// XXX: note that these files should not use config options
|
// XXX: note that these files should not use config options
|
||||||
// at compile time since DB config options are not yet loaded.
|
// at compile time since DB config options are not yet loaded.
|
||||||
|
Loading…
Reference in New Issue
Block a user