Make getUserPermissionsErrors(Expensive) actually handle $result as documented
authorNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 24 May 2010 09:55:46 +0000 (09:55 +0000)
committerNiklas Laxström <nikerabbit@users.mediawiki.org>
Mon, 24 May 2010 09:55:46 +0000 (09:55 +0000)
Fatal errors was caused by nesting the results one level too deep

includes/Title.php

index ff4a213..8bdc183 100644 (file)
@@ -1272,12 +1272,12 @@ class Title {
                }
                // Check getUserPermissionsErrors hook
                if ( !wfRunHooks( 'getUserPermissionsErrors', array( &$this, &$user, $action, &$result ) ) ) {
-                       $errors[] = $this->resultToError( $errors, $result );
+                       $errors = $this->resultToError( $errors, $result );
                }
                // Check getUserPermissionsErrorsExpensive hook
                if ( $doExpensiveQueries && !( $short && count( $errors ) > 0 ) &&
                         !wfRunHooks( 'getUserPermissionsErrorsExpensive', array( &$this, &$user, $action, &$result ) ) ) {
-                       $errors[] = $this->resultToError( $errors, $result );
+                       $errors = $this->resultToError( $errors, $result );
                }
 
                return $errors;