From: Fabien Potencier Date: Wed, 1 May 2013 05:08:24 +0000 (+0200) Subject: merged branch hason/tests_autoloader (PR #994) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=f29bebbed0d3cf2067f4a611f257a86b5344c0c9;p=web%2Fkonrad%2Ftwig.git merged branch hason/tests_autoloader (PR #994) This PR was merged into the master branch. Discussion ---------- Fixed autoloader registration for tests if phpunit is installed as package together with Twig Commits ------- 19869ce Fixed autoloader registration for tests if phpunit is installed as package together with Twig --- f29bebbed0d3cf2067f4a611f257a86b5344c0c9 diff --cc lib/Twig/Autoloader.php index c36a4c7,736605d..9b437fa --- a/lib/Twig/Autoloader.php +++ b/lib/Twig/Autoloader.php @@@ -18,10 -18,17 +18,16 @@@ class Twig_Autoloade { /** * Registers Twig_Autoloader as an SPL autoloader. + * + * @param Bolean $prepend Whether to prepend the autoloader or not. */ - public static function register() + public static function register($prepend = false) { - spl_autoload_register(array(new self, 'autoload')); - ini_set('unserialize_callback_func', 'spl_autoload_call'); + if ($prepend && version_compare(phpversion(), '5.3.0RC1', '>=')) { + spl_autoload_register(array(new self, 'autoload'), true, $prepend); + } else { + spl_autoload_register(array(new self, 'autoload'), true); + } } /**