removed the ability to register a global variable after the runtime or the extensions have been initialized

This commit is contained in:
Fabien Potencier
2013-08-05 18:59:29 +02:00
parent 79f52aa6e1
commit 0b0385f32f
3 changed files with 1 additions and 4 deletions
+1
View File
@@ -1,5 +1,6 @@
* 2.0.0 (201X-XX-XX)
* removed the ability to register a global variable after the runtime or the extensions have been initialized
* improved the performance of the filesystem loader
* removed features that were deprecated in 1.x
-2
View File
@@ -1044,11 +1044,9 @@ class Twig_Environment
$this->globals = $this->initGlobals();
}
/* This condition must be uncommented in Twig 2.0
if (!array_key_exists($name, $this->globals)) {
throw new LogicException(sprintf('Unable to add global "%s" as the runtime or the extensions have already been initialized.', $name));
}
*/
}
if ($this->extensionInitialized || $this->runtimeInitialized) {
-2
View File
@@ -87,7 +87,6 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
$template = $twig->loadTemplate('index');
$this->assertEquals('bar', $template->render(array()));
/* to be uncomment in Twig 2.0
// globals cannot be added after runtime init
$twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
$twig->addGlobal('foo', 'foo');
@@ -134,7 +133,6 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
} catch (LogicException $e) {
$this->assertFalse(array_key_exists('bar', $twig->getGlobals()));
}
*/
}
public function testExtensionsAreNotInitializedWhenRenderingACompiledTemplate()