diff --git a/CHANGELOG b/CHANGELOG index 8ef573649..a696793b7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index 2a3e8b207..9b7cae9db 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -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) { diff --git a/test/Twig/Tests/EnvironmentTest.php b/test/Twig/Tests/EnvironmentTest.php index bfe5bd3a6..988d47d31 100644 --- a/test/Twig/Tests/EnvironmentTest.php +++ b/test/Twig/Tests/EnvironmentTest.php @@ -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()