Explorar el Código

Remove exceptions on multiple * in dynamic names.

Per the finalized spec, these should be treated as lookup failures (i.e. rendered as empty strings) rather than exceptions.
Justin Hileman hace 3 años
padre
commit
93f824d09a
Se han modificado 2 ficheros con 0 adiciones y 34 borrados
  1. 0 6
      src/Mustache/Parser.php
  2. 0 28
      test/Mustache/Test/Functional/DynamicPartialsTest.php

+ 0 - 6
src/Mustache/Parser.php

@@ -313,12 +313,6 @@ class Mustache_Parser
             $isDynamic = true;
         }
 
-        // Two stars is two many!
-        if (preg_match('/^\s*\*\s*/', $name) || preg_match('/[|.]\s*\*/', $name)) {
-            $msg = sprintf('Invalid dynamic name: %s', $name);
-            throw new Mustache_Exception_SyntaxException($msg, $token);
-        }
-
         return array($name, $isDynamic);
     }
 

+ 0 - 28
test/Mustache/Test/Functional/DynamicPartialsTest.php

@@ -24,34 +24,6 @@ class Mustache_Test_Functional_DynamicPartialsTest extends PHPUnit_Framework_Tes
         ));
     }
 
-    public function getInvalidDynamicNamesExamples()
-    {
-        return array(
-            array('{{> **foo}}'),
-            array('{{> *foo.*bar}}'),
-            array('{{> foo.*bar}}'),
-            array('{{ *foo }}'),
-            array('{{{ *foo }}}'),
-            array('{{& *foo }}'),
-            array('{{# *foo }}{{/ *foo }}'),
-            array('{{^ *foo }}{{/ *foo }}'),
-            array('{{% FILTERS}}{{> *foo | *bar}}'),
-            array('{{% FILTERS}}{{> foo | *bar}}'),
-            array('{{% BLOCKS }}{{$ *foo }}{{/ *foo }}'),
-        );
-    }
-
-    /**
-     * @dataProvider getInvalidDynamicNamesExamples
-     * @expectedException Mustache_Exception_SyntaxException
-     * @expectedExceptionMessage Invalid dynamic name:
-     */
-    public function testInvalidDynamicNamesExamples($template)
-    {
-        $this->mustache->render($template);
-    }
-
-
     public function getValidDynamicNamesExamples()
     {
       // technically not all dynamic names, but also not invalid