diff --git a/Cite.php b/Cite.php index 756a08bb7..83f060dec 100644 --- a/Cite.php +++ b/Cite.php @@ -291,7 +291,7 @@ function wfCite() { ); } else { // We've been here before - if ( empty($this->mRefs[$key]['text']) and !empty($str)) { + if ( $this->mRefs[$key]['text'] === null && $str !== '' ) { // If no text found before, use this text $this->mRefs[$key]['text'] = $str; }; diff --git a/citeParserTests.txt b/citeParserTests.txt index e966fe385..9bac1ab03 100644 --- a/citeParserTests.txt +++ b/citeParserTests.txt @@ -136,3 +136,51 @@ TemplatingText
1337
!! end + +!! test +Blank ref followed by ref with content +!! input + + +content + +[1] +
[1] +
+ + +!! end + +!! test +Regression: non-blank ref "0" followed by ref with content +!! input +0 + +content + +[1] +
[1] +
+ + +!! end + +!! test +Regression sanity check: non-blank ref "1" followed by ref with content +!! input +1 + +content + +[1] +
[1] +
+ + +!! end