From e12473729f0f90352b6c79bff5c4a733b61e0187 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Fri, 31 May 2013 15:21:39 -0700 Subject: [PATCH] Throw an exception in ScopedCallback for invalid callbacks. Change-Id: I303dec64e55df0b1de73c6db6577bfb005cbe464 --- includes/ScopedCallback.php | 4 ++++ 1 file changed, 4 insertions(+) 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; } -- 2.20.1