Proper fix: Put in non-exception throwing handler for undefined methods on Medium objects

This commit is contained in:
Andy Miller
2015-01-06 11:33:53 -07:00
parent c515996adc
commit 22e550ab40

View File

@@ -313,7 +313,12 @@ class Medium extends Data
if (!$this->image) {
$this->image();
}
$result = call_user_func_array(array($this->image, $method), $args);
try {
$result = call_user_func_array(array($this->image, $method), $args);
} catch (\BadFunctionCallException $e) {
$result = null;
}
// Returns either current object or result of the action.
return $result instanceof ImageFile ? $this : $result;