merged branch za-creature/patch-1 (PR #943)

This PR was merged into the master branch.

Commits
-------

15be13c Update lib/Twig/Autoloader.php

Discussion
----------

Update lib/Twig/Autoloader.php

Added the ability to register the autoloader at the top of the stack, useful in some situations.

Specifically, I need this because I want the last autoload function registered in my application to throw an exception instead of producing a class not found error, and I need *that* autoloader to be registered before twig's.
This commit is contained in:
Fabien Potencier
2013-01-02 16:58:50 +01:00
+6 -2
View File
@@ -19,11 +19,15 @@ class Twig_Autoloader
{
/**
* Registers Twig_Autoloader as an SPL autoloader.
*
* @param boolean $prepend (optional) Whether to add the autoloader to
* the start of the stack. Defaults to false so the autoloader will be
* appended to the stack.
*/
public static function register()
public static function register($prepend = false)
{
ini_set('unserialize_callback_func', 'spl_autoload_call');
spl_autoload_register(array(new self, 'autoload'));
spl_autoload_register(array(new self, 'autoload'), true, $prepend);
}
/**