From f5650806cc0556d93ada1b43b16608ea3695c76a Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 5 Jan 2011 23:27:17 +0000 Subject: [PATCH] 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 --- lib/common.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/common.php b/lib/common.php index 6138200e49..b072a49699 100644 --- a/lib/common.php +++ b/lib/common.php @@ -95,7 +95,11 @@ function _have_config() 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')) { 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: note that these files should not use config options // at compile time since DB config options are not yet loaded.