diff --git a/Cite_body.php b/Cite_body.php
index 9daf9217f..7ec21483d 100644
--- a/Cite_body.php
+++ b/Cite_body.php
@@ -235,8 +235,14 @@ class Cite {
$this->mReferencesErrors[] =
$this->error( 'cite_error_references_missing_key', $key );
} else {
- # Assign the text to corresponding ref
- $this->mRefs[$group][$key]['text'] = $str;
+ if ( isset( $this->mRefs[$group][$key]['text'] ) && $str !== $this->mRefs[$group][$key]['text'] ) {
+ // two refs with same key and different content
+ // add error message to the original ref
+ $this->mRefs[$group][$key]['text'] .= ' ' . $this->error( 'cite_error_references_duplicate_key', $key, 'noparse' );
+ } else {
+ # Assign the text to corresponding ref
+ $this->mRefs[$group][$key]['text'] = $str;
+ }
}
} else {
# called in
<ref>
tag; name "a" defined multiple times with different content
+[1] +
+<ref>
tag; name "a" defined multiple times with different content
+[1] +
+<ref>
tag; name "a" defined multiple times with different content
+