Merge "registration: Improve error message for invalid "callback" in extension.json"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 9 Sep 2017 00:13:46 +0000 (00:13 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 9 Sep 2017 00:13:46 +0000 (00:13 +0000)
includes/registration/ExtensionRegistry.php

index eac04a9..bf33c6c 100644 (file)
@@ -332,6 +332,12 @@ class ExtensionRegistry {
                }
 
                foreach ( $info['callbacks'] as $name => $cb ) {
+                       if ( !is_callable( $cb ) ) {
+                               if ( is_array( $cb ) ) {
+                                       $cb = '[ ' . implode( ', ', $cb ) . ' ]';
+                               }
+                               throw new UnexpectedValueException( "callback '$cb' is not callable" );
+                       }
                        call_user_func( $cb, $info['credits'][$name] );
                }
        }