r111250 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111249‎ | r111250 | r111251 >
Date:18:09, 11 February 2012
Author:mkroetzsch
Status:deferred
Tags:
Comment:
more robust behaviour when uniq tags are found in input; Bug 30717
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DataValue.php
@@ -160,18 +160,16 @@
161161 $this->mHasServiceLinks = false;
162162 $this->m_caption = is_string( $caption ) ? trim( $caption ) : false;
163163
 164+
 165+ $this->parseUserValue( $value ); // may set caption if not set yet, depending on datavalue
 166+
164167 // The following checks for markers generated by MediaWiki to handle special content,
165168 // e.g. math. In general, we are not prepared to handle such content properly, and we
166169 // also have no means of obtaining the user input at this point. Hence the assignement
167 - // just fails.
 170+ // just fails, even if parseUserValue() above might not have noticed this issue.
168171 // Note: \x07 was used in MediaWiki 1.11.0, \x7f is used now (backwards compatiblity, b/c)
169 - if ( ( strpos( $value, "\x7f" ) === false ) && ( strpos( $value, "\x07" ) === false ) ) {
170 - $this->parseUserValue( $value ); // may set caption if not set yet, depending on datavalue
171 - } else {
 172+ if ( ( strpos( $value, "\x7f" ) !== false ) || ( strpos( $value, "\x07" ) !== false ) ) {
172173 $this->addError( wfMsgForContent( 'smw_parseerror' ) );
173 - if ( $this->m_caption === false ) {
174 - $this->m_caption = $value; // ensure that at least input can be shown
175 - }
176174 }
177175
178176 if ( $this->isValid() ) {