Jackmcbarn has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/214099

Change subject: Give the same error for a blank ref tag and a self-closing one
......................................................................

Give the same error for a blank ref tag and a self-closing one

Currently, inside references, a ref tag containing an empty string does
produce an error, while a self-closing ref tag doesn't. This change
causes the latter to produce an error as well.

Change-Id: Ic74b4538bae8250334a52a37fe4b4ad1295079ab
---
M Cite_body.php
M citeParserTests.txt
2 files changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cite 
refs/changes/99/214099/1

diff --git a/Cite_body.php b/Cite_body.php
index e5f0a5a..1423824 100644
--- a/Cite_body.php
+++ b/Cite_body.php
@@ -226,7 +226,7 @@
                                # <ref> and <references> have conflicting group 
attributes.
                                $this->mReferencesErrors[] =
                                        $this->error( 
'cite_error_references_group_mismatch', htmlspecialchars( $group ) );
-                       } elseif ( $str !== '' ) {
+                       } elseif ( $str !== '' && $str !== null ) {
                                if ( !isset( $this->mRefs[$group] ) ) {
                                        # Called with group attribute not 
defined in text.
                                        $this->mReferencesErrors[] =
diff --git a/citeParserTests.txt b/citeParserTests.txt
index 2477f2d..a6228c1 100644
--- a/citeParserTests.txt
+++ b/citeParserTests.txt
@@ -384,7 +384,8 @@
 <li id="cite_note-foo"><span class="mw-cite-backlink"><a 
href="#cite_ref-foo_0">↑</a></span> <strong class="error 
mw-ext-cite-error">Cite error: Invalid <code>&lt;ref&gt;</code> tag;
 no text was provided for refs named <code>foo</code></strong></li>
 </ol>
-<p><strong class="error mw-ext-cite-error">Cite error: 
<code>&lt;ref&gt;</code> tag with name "unused" defined in 
<code>&lt;references&gt;</code> is not used in prior text.</strong><br />
+<p><strong class="error mw-ext-cite-error">Cite error: 
<code>&lt;ref&gt;</code> tag defined in <code>&lt;references&gt;</code> with 
name "foo" has no content.</strong><br />
+<strong class="error mw-ext-cite-error">Cite error: <code>&lt;ref&gt;</code> 
tag with name "unused" defined in <code>&lt;references&gt;</code> is not used 
in prior text.</strong><br />
 <strong class="error mw-ext-cite-error">Cite error: <code>&lt;ref&gt;</code> 
tag in <code>&lt;references&gt;</code> has conflicting group attribute 
"1".</strong><br />
 <strong class="error mw-ext-cite-error">Cite error: <code>&lt;ref&gt;</code> 
tag defined in <code>&lt;references&gt;</code> has no name attribute.</strong>
 </p>

-- 
To view, visit https://gerrit.wikimedia.org/r/214099
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic74b4538bae8250334a52a37fe4b4ad1295079ab
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: Jackmcbarn <jackmcb...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to