From: Fabien Potencier Date: Sat, 12 Jun 2010 14:46:54 +0000 (+0200) Subject: changed the default value of strict_variables to false X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=2ce6b27fe49acb2602c0fc5c66d4891b995ca4a9;p=konrad%2Ftwig.git changed the default value of strict_variables to false --- diff --git a/CHANGELOG b/CHANGELOG index 46d1302..f5c98a1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,7 +16,7 @@ Backward incompatibilities: * added a bunch of phpdoc * added a sandbox tag in the sandbox extension * changed the date filter to support any date format supported by DateTime - * added strict_variable setting to throw an exception when an invalid variable is used in a template (disabled by default when debug is false) + * added strict_variable setting to throw an exception when an invalid variable is used in a template (disabled by default) * added the lexer, parser, and compiler as arguments to the Twig_Environment constructor * changed the cache option to only accepts an explicit path to a cache directory or false * added a way to add token parsers, filters, and visitors without creating an extension diff --git a/doc/03-Twig-for-Developers.markdown b/doc/03-Twig-for-Developers.markdown index b2d7a6d..9b75b70 100644 --- a/doc/03-Twig-for-Developers.markdown +++ b/doc/03-Twig-for-Developers.markdown @@ -96,9 +96,7 @@ The following options are available: * `strict_variables` (new in Twig 0.9.7): If set to `false`, Twig will silently ignore invalid variables (variables and or attributes/methods that do not exist) and replace them with a `null` value. When set to `true`, - Twig throws an exception instead. If you don't provide a value for the - `strict_variables` option, it will be determined automatically based on the - `debug` value. + Twig throws an exception instead (default to `false`). >**CAUTION** >Before Twig 0.9.3, the `cache` and `auto_reload` options did not exist. They diff --git a/lib/Twig/Environment.php b/lib/Twig/Environment.php index 57c4808..9b33e2f 100644 --- a/lib/Twig/Environment.php +++ b/lib/Twig/Environment.php @@ -56,7 +56,7 @@ class Twig_Environment * determined automatically base on the debug value. * * * strict_variables: Whether to ignore invalid variables in templates - * (default to the value of debug). + * (default to false). * * @param Twig_LoaderInterface $loader A Twig_LoaderInterface instance * @param array $options An array of options @@ -80,7 +80,7 @@ class Twig_Environment $this->baseTemplateClass = isset($options['base_template_class']) ? $options['base_template_class'] : 'Twig_Template'; $this->autoReload = isset($options['auto_reload']) ? (bool) $options['auto_reload'] : $this->debug; $this->extensions = array('core' => new Twig_Extension_Core()); - $this->strictVariables = isset($options['strict_variables']) ? (bool) $options['strict_variables'] : $this->debug; + $this->strictVariables = isset($options['strict_variables']) ? (bool) $options['strict_variables'] : false; $this->runtimeInitialized = false; if (isset($options['cache']) && $options['cache']) { $this->setCache($options['cache']);