From: Aaron Schulz Date: Fri, 31 May 2013 22:21:39 +0000 (-0700) Subject: Throw an exception in ScopedCallback for invalid callbacks. X-Git-Tag: 1.31.0-rc.0~19523 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/ajouter.php?a=commitdiff_plain;h=e12473729f0f90352b6c79bff5c4a733b61e0187;p=lhc%2Fweb%2Fwiklou.git Throw an exception in ScopedCallback for invalid callbacks. Change-Id: I303dec64e55df0b1de73c6db6577bfb005cbe464 --- diff --git a/includes/ScopedCallback.php b/includes/ScopedCallback.php index fa88c0ee4f..ef22e0a30d 100644 --- a/includes/ScopedCallback.php +++ b/includes/ScopedCallback.php @@ -31,8 +31,12 @@ class ScopedCallback { /** * @param callable $callback + * @throws MWException */ public function __construct( $callback ) { + if ( !is_callable( $callback ) ) { + throw new MWException( "Provided callback is not valid." ); + } $this->callback = $callback; }