From ac418ad8767473e7b4a1f8d14b041df929e1afd7 Mon Sep 17 00:00:00 2001 From: Damien Tournoud Date: Tue, 7 Dec 2010 11:43:23 -0500 Subject: [PATCH] Restrict the callable lambda to object calls and anonymous functions. --- Mustache.php | 6 +----- test/MustacheHigherOrderSectionsTest.php | 3 --- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Mustache.php b/Mustache.php index df52755..6f57a25 100644 --- a/Mustache.php +++ b/Mustache.php @@ -847,17 +847,13 @@ class Mustache { * 1. an anonymous function. * 2. an object and the name of a public function, i.e. `array($SomeObject, 'methodName')` * 3. a class name and the name of a public static function, i.e. `array('SomeClass', 'methodName')` - * 4. a static function name in the form `'SomeClass::methodName'` * * @access protected * @param mixed $var * @return bool */ protected function _varIsCallable($var) { - if (is_string($var) && (strpos($var, '::') == false)) { - return false; - } - return is_callable($var); + return !is_string($var) && is_callable($var); } } diff --git a/test/MustacheHigherOrderSectionsTest.php b/test/MustacheHigherOrderSectionsTest.php index 88077f0..87e4142 100644 --- a/test/MustacheHigherOrderSectionsTest.php +++ b/test/MustacheHigherOrderSectionsTest.php @@ -40,9 +40,6 @@ class MustacheHigherOrderSectionsTest extends PHPUnit_Framework_TestCase { public function testStaticSectionCallback() { $this->foo->trimmer = array(get_class($this->foo), 'staticTrim'); $this->assertEquals($this->foo->name, $this->foo->render('{{#trimmer}} {{name}} {{/trimmer}}')); - - $this->foo->trimmer = 'Foo::staticTrim'; - $this->assertEquals($this->foo->lorem, $this->foo->render('{{#trimmer}} {{lorem}} {{/trimmer}}')); } public function testViewArraySectionCallback() {