SpecialVersion: Handle Closures in $wgHooks nicer
authorKunal Mehta <legoktm@gmail.com>
Thu, 24 Jul 2014 01:20:41 +0000 (18:20 -0700)
committerPaladox <thomasmulhall410@yahoo.com>
Sat, 8 Aug 2015 10:31:32 +0000 (10:31 +0000)
Currently it'll output random gibberish like:
"(Closure$;587075805$f9f7d1b29ead2f059510beaa30fd9f8$)",
which is pretty useless. Just "Closure" is good enough.

Change-Id: I1f1d55e59545c586ed5e5d1545071ebf48b5c753

includes/specials/SpecialVersion.php

index 4fb6772..a52428f 100644 (file)
@@ -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;