Fix undefined variable in Status::getMessage()
authoraude <aude.wiki@gmail.com>
Thu, 24 Oct 2013 19:17:39 +0000 (19:17 +0000)
committeraude <aude.wiki@gmail.com>
Thu, 24 Oct 2013 19:29:05 +0000 (19:29 +0000)
If $shortContext and $longContext are false, and there
are errors, then $s is undefined.

Change-Id: Ie07f80b43a48a6fc4ed28b2c519f51fd32690bc8

includes/Status.php

index ab24201..928f8eb 100644 (file)
@@ -238,8 +238,14 @@ class Status {
                        }
                } else {
                        $msgs =  $this->getErrorMessageArray( $this->errors );
-                       $wrapper = new RawMessage( '* $' . implode( "\n* \$", range( 1, count( $msgs ) + 1 ) ) );
-                       $wrapper->params( $msgs )->parse();
+                       $msgCount = count( $msgs );
+
+                       if ( $shortContext ) {
+                               $msgCount++;
+                       }
+
+                       $wrapper = new RawMessage( '* $' . implode( "\n* \$", range( 1, $msgCount ) ) );
+                       $s = $wrapper->params( $msgs )->parse();
 
                        if ( $longContext ) {
                                $s = wfMessage( $longContext, $wrapper );
@@ -249,6 +255,7 @@ class Status {
                                $s = wfMessage( $shortContext, $wrapper );
                        }
                }
+
                return $s;
        }