From: Kunal Mehta Date: Thu, 24 Jul 2014 01:20:41 +0000 (-0700) Subject: SpecialVersion: Handle Closures in $wgHooks nicer X-Git-Tag: 1.31.0-rc.0~10303^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=e66ee985e0792d2c28ebb0d5b299af5bce87eb9b;p=lhc%2Fweb%2Fwiklou.git SpecialVersion: Handle Closures in $wgHooks nicer Currently it'll output random gibberish like: "(Closure$;587075805$f9f7d1b29ead2f059510beaa30fd9f8$)", which is pretty useless. Just "Closure" is good enough. Change-Id: I1f1d55e59545c586ed5e5d1545071ebf48b5c753 --- diff --git a/includes/specials/SpecialVersion.php b/includes/specials/SpecialVersion.php index 4fb67727cf..a52428fa0d 100644 --- a/includes/specials/SpecialVersion.php +++ b/includes/specials/SpecialVersion.php @@ -1116,7 +1116,10 @@ class SpecialVersion extends SpecialPage { if ( is_array( $list ) && count( $list ) == 1 ) { $list = $list[0]; } - if ( is_object( $list ) ) { + if ( $list instanceof Closure ) { + // Don't output stuff like "Closure$;1028376090#8$48499d94fe0147f7c633b365be39952b$" + return 'Closure'; + } elseif ( is_object( $list ) ) { $class = wfMessage( 'parentheses' )->params( get_class( $list ) )->escaped(); return $class;