X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FHooks.php;h=f4f86be68bb0a0077351de0a82794d7f6257b65d;hb=b3f7f4e1e2bb7dec0d58d5459627f2b4fc13a3aa;hp=b6c194c12ac14f4e6871b95fbba1c91ae48c1d81;hpb=40a628a501fc05bb00e834fe359ca4061925f320;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Hooks.php b/includes/Hooks.php index b6c194c12a..f4f86be68b 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -64,7 +64,7 @@ class Hooks { * @throws MWException If not in testing mode. */ public static function clear( $name ) { - if ( !defined( 'MW_PHPUNIT_TEST' ) ) { + if ( !defined( 'MW_PHPUNIT_TEST' ) && !defined( 'MW_PARSER_TEST' ) ) { throw new MWException( 'Cannot reset hooks in operation.' ); } @@ -176,22 +176,13 @@ class Hooks { throw new MWException( 'Invalid callback ' . $func . ' in hooks for ' . $event . "\n" ); } - /* - * Call the hook. The documentation of call_user_func_array says - * false is returned on failure. However, if the function signature - * does not match the call signature, PHP will issue an warning and - * return null instead. The following code catches that warning and - * provides better error message. - */ - $retval = null; - $badhookmsg = null; - $hook_args = array_merge( $hook, $args ); - // mark hook as deprecated, if deprecation version is specified if ( $deprecatedVersion !== null ) { wfDeprecated( "$event hook (used in $func)", $deprecatedVersion ); } + // Call the hook. + $hook_args = array_merge( $hook, $args ); $retval = call_user_func_array( $callback, $hook_args ); // Process the return value.