Ver Fonte

Merge branch 'dev' into feature/mustache-spec

Justin Hileman há 15 anos atrás
pai
commit
55e3a036f2
1 ficheiros alterados com 17 adições e 0 exclusões
  1. 17 0
      test/MustacheTest.php

+ 17 - 0
test/MustacheTest.php

@@ -350,4 +350,21 @@ class MustacheTest extends PHPUnit_Framework_TestCase {
 			array('{{#foo}}{{/bar}}{{/foo}}'),
 		);
 	}
+
+	/**
+	 * Ensure that Mustache doesn't double-render sections (allowing mustache injection).
+	 *
+	 * @group sections
+	 */
+	public function testMustacheInjection() {
+		$template = '{{#foo}}{{bar}}{{/foo}}';
+		$view = array(
+			'foo' => true,
+			'bar' => '{{win}}',
+			'win' => 'FAIL',
+		);
+
+		$m = new Mustache($template, $view);
+		$this->assertEquals('{{win}}', $m->render());
+	}
 }