Browse Source

change is_callable checks to instanceof Closure.

Taylor Otwell 13 years ago
parent
commit
fb3a0df0dd

+ 1 - 1
laravel/arr.php

@@ -27,7 +27,7 @@ class Arr {
 		{
 			if ( ! is_array($array) or ! array_key_exists($segment, $array))
 			{
-				return is_callable($default) ? call_user_func($default) : $default;
+				return ($default instanceof \Closure) ? call_user_func($default) : $default;
 			}
 
 			$array = $array[$segment];

+ 2 - 2
laravel/cache/driver.php

@@ -38,7 +38,7 @@ abstract class Driver {
 	{
 		if ( ! is_null($item = $this->retrieve($key))) return $item;
 
-		return (is_callable($default)) ? call_user_func($default) : $default;
+		return ($default instanceof \Closure) ? call_user_func($default) : $default;
 	}
 
 	/**
@@ -82,7 +82,7 @@ abstract class Driver {
 	{
 		if ( ! is_null($item = $this->get($key, null))) return $item;
 
-		$default = is_callable($default) ? call_user_func($default) : $default;
+		$default = ($default instanceof \Closure) ? call_user_func($default) : $default;
 
 		$this->put($key, $default, $minutes);
 

+ 1 - 1
laravel/config.php

@@ -58,7 +58,7 @@ class Config {
 
 		if ( ! static::load($file))
 		{
-			return is_callable($default) ? call_user_func($default) : $default;
+			return ($default instanceof \Closure) ? call_user_func($default) : $default;
 		}
 
 		if (is_null($key)) return static::$items[$file];

+ 1 - 1
laravel/lang.php

@@ -88,7 +88,7 @@ class Lang {
 
 		if ( ! $this->load($file))
 		{
-			return is_callable($default) ? call_user_func($default) : $default;
+			return ($default instanceof \Closure) ? call_user_func($default) : $default;
 		}
 
 		$line = Arr::get(static::$lines[$this->language.$file], $line, $default);

+ 1 - 1
laravel/routing/handler.php

@@ -83,7 +83,7 @@ class Handler {
 	{
 		if (isset($route->callback['do'])) return $route->callback['do'];
 
-		foreach ($route->callback as $value) { if (is_callable($value)) return $value; }
+		foreach ($route->callback as $value) { if ($value instanceof Closure) return $value; }
 	}
 
 	/**

+ 1 - 1
laravel/session/driver.php

@@ -104,7 +104,7 @@ abstract class Driver {
 			if (array_key_exists($possibility, $this->session['data'])) return $this->session['data'][$possibility];
 		}
 
-		return is_callable($default) ? call_user_func($default) : $default;
+		return ($default instanceof \Closure) ? call_user_func($default) : $default;
 	}
 
 	/**

+ 1 - 1
laravel/view.php

@@ -91,7 +91,7 @@ class View implements Renderable {
 		{
 			foreach ((array) $composers[$this->view] as $key => $value)
 			{
-				if (is_callable($value)) return call_user_func($value, $this);
+				if ($value instanceof \Closure) return call_user_func($value, $this);
 			}
 		}
 	}