Skip to content

Commit

Permalink
Updated method Phalcon\Fitler::add
Browse files Browse the repository at this point in the history
  • Loading branch information
dreamsxin committed May 28, 2015
1 parent 3bb3416 commit ac20eef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions phalcon/filter.zep
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class Filter implements FilterInterface
*/
public function add(string! name, handler) -> <Filter>
{
if typeof handler != "object" {
throw new Exception("Filter must be an object");
if typeof handler != "object" && !is_callable(handler) {
throw new Exception("Filter must be an object or callable");
}

let this->_filters[name] = handler;
Expand Down Expand Up @@ -134,7 +134,7 @@ class Filter implements FilterInterface
/**
* If the filter is a closure we call it in the PHP userland
*/
if filterObject instanceof \Closure {
if filterObject instanceof \Closure || is_callable(filterObject) {
return call_user_func_array(filterObject, [value]);
}

Expand Down

0 comments on commit ac20eef

Please sign in to comment.