Permalink
Browse files

Better detection of object callbacks

- array(object $object, string $method) is a valid object callback
  • Loading branch information...
1 parent 537a811 commit 84210319660ea0092bb57bb48285c453e72547e8 @weierophinney weierophinney committed Oct 5, 2011
Showing with 11 additions and 4 deletions.
  1. +1 −1 .vimproject
  2. +10 −3 library/Phly/Mustache/Renderer.php
View
@@ -34,7 +34,7 @@ mustache=/home/matthew/git/phly_mustache CD=. filter="*.php *.html *.xml *.txt"
}
}
}
- tests=tests {
+ tests=tests CD=. {
bootstrap.php
phpunit.xml
PhlyTest=PhlyTest {
@@ -453,12 +453,19 @@ protected function handlePragmas($token, $data, $view)
*/
protected function isValidCallback($callback)
{
- if (is_string($callback) || is_array($callback)) {
- // For security purposes, we don't want to call anything that isn't
- // an object callback
+ // For security purposes, we don't want to call anything that isn't
+ // an object callback
+ if (is_string($callback)) {
return false;
}
+ if (is_array($callback)) {
+ $target = array_shift($callback);
+ if (!is_object($target)) {
+ return false;
+ }
+ }
+
// Object callback -- always okay
return true;
}

0 comments on commit 8421031

Please sign in to comment.