fuel / parser

Fuel PHP Framework - v1.x template parser package adapters
http://fuelphp.com
64 stars 45 forks source link

Parser doesn't work with the last Twig release (1.12.0) #57

Closed billmn closed 11 years ago

billmn commented 11 years ago

With the release 1.12.0 of Twig now we have this error :

LogicException [ Error ]: Unable to add global "%GLOBAL_VARIABLE%" as the runtime or the extensions have already been initialized.

This because with this release "Global Variables" must be initialized before the Lexer instance and then can be overwritten on render :

Check this discussion : https://groups.google.com/forum/?fromgroups=#!topic/silex-php/Ew-Fs5VXqlQ

The problem is the position of addGlobal() method :

if ( ! empty($global_data))
{
    foreach ($global_data as $key => $value)
    {
        static::parser()->addGlobal($key, $value);
    }
}

How can we solve this?

billmn commented 11 years ago

Fixed by 468ee76ed58d8820bd4cbf99e824d29967185a6b