From 893db13b5c05a8e2d976c40e39cf4af3715a63fd Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Thu, 5 May 2016 12:09:33 -0700 Subject: [PATCH] Move check for non-existing reference count higher up It doesn't make sense to check for negative numbers or 0 if the value doesn't even exist. It ends up spamming the warning logs prior to actually hitting the case we want. Change-Id: I8f6cf17d4cd628fdcff13f2d29c7ae9661444de2 --- Cite_body.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Cite_body.php b/Cite_body.php index a36cae200..ee556e725 100644 --- a/Cite_body.php +++ b/Cite_body.php @@ -806,7 +806,14 @@ class Cite { $text )->inContentLanguage()->plain(); } - + if ( !isset( $val['count'] ) ) { + // this handles the case of section preview for list-defined references + return wfMessage( 'cite_references_link_many', + self::getReferencesKey( $key . "-" . $val['key'] ), + '', + $text + )->inContentLanguage()->plain(); + } if ( $val['count'] < 0 ) { return wfMessage( 'cite_references_link_one', @@ -830,14 +837,6 @@ class Cite { )->inContentLanguage()->plain(); // Named references with >1 occurrences } - if ( !isset( $val['count'] ) ) { - // this handles the case of section preview for list-defined references - return wfMessage( 'cite_references_link_many', - self::getReferencesKey( $key . "-" . $val['key'] ), - '', - $text - )->inContentLanguage()->plain(); - } $links = array(); // for group handling, we have an extra key here. for ( $i = 0; $i <= $val['count']; ++$i ) {