From 92e284d3fa62f45e20fed34c4359c575481d583c Mon Sep 17 00:00:00 2001 From: aude Date: Thu, 24 Oct 2013 19:17:39 +0000 Subject: [PATCH] Fix undefined variable in Status::getMessage() If $shortContext and $longContext are false, and there are errors, then $s is undefined. Change-Id: Ie07f80b43a48a6fc4ed28b2c519f51fd32690bc8 --- includes/Status.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/includes/Status.php b/includes/Status.php index ab242011c7..928f8ebd61 100644 --- a/includes/Status.php +++ b/includes/Status.php @@ -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; } -- 2.20.1