r112856 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112855‎ | r112856 | r112857 >
Date:00:18, 2 March 2012
Author:krinkle
Status:ok (Comments)
Tags:
Comment:
[CategoryTree] Fix "bad json errors on options= {":" that are populating wmf error logs
* Only occurred on category trees produced by <categorytree>. The category trees dynamically created when expanding the [+] toggle in the subcategory list on a category page were not affected (since those don't have data-ct-options attributes and thus JS uses the default via mw.config.get( 'wgCategoryTreePageCategoryOptions' ), which wasn't double escaped)
* escapeTagsOnly escapes & to &quot;
* Xml::openElement does normal attribute escaping, assuming unescaped input

Before:

<div class=" CategoryTreeTag" data-ct-mode="0" data-ct-options="{&amp;quot;mode&amp;quot;:0,&amp;quot;hideprefix&amp;quot;:20,&amp;quot;showcount&amp;quot;:false,&amp;quot;namespaces&amp;quot;:false}">

<div class="CategoryTreeTag" data-ct-mode="0" data-ct-options="{&quot;mode&quot;:0,&quot;hideprefix&quot;:20,&quot;showcount&quot;:false,&quot;namespaces&quot;:false}">
Modified paths:
  • /trunk/extensions/CategoryTree/CategoryTreeFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CategoryTree/CategoryTreeFunctions.php
@@ -424,19 +424,19 @@
425425 }
426426
427427 $attr['data-ct-mode'] = $this->mOptions['mode'];
428 - $attr['data-ct-options'] = Xml::escapeTagsOnly( $this->getOptionsAsJsStructure() );
 428+ $attr['data-ct-options'] = $this->getOptionsAsJsStructure();
429429
430430 $html = '';
431 - $html .= Xml::openElement( 'div', $attr );
 431+ $html .= Html::openElement( 'div', $attr );
432432
433433 if ( !$allowMissing && !$title->getArticleID() ) {
434 - $html .= Xml::openElement( 'span', array( 'class' => 'CategoryTreeNotice' ) );
 434+ $html .= Html::openElement( 'span', array( 'class' => 'CategoryTreeNotice' ) );
435435 if ( $parser ) {
436436 $html .= $parser->recursiveTagParse( wfMsgNoTrans( 'categorytree-not-found', $category ) );
437437 } else {
438438 $html .= wfMsgExt( 'categorytree-not-found', 'parseinline', htmlspecialchars( $category ) );
439439 }
440 - $html .= Xml::closeElement( 'span' );
 440+ $html .= Html::closeElement( 'span' );
441441 }
442442 else {
443443 if ( !$hideroot ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r112862MFT r112849, r112851, r112856, r112859aaron00:40, 2 March 2012
r113037MFT r110703, r110933, r111011, r111218, r112520, r112524, r112660, r112687, r...reedy14:59, 5 March 2012

Comments

#Comment by Krinkle (talk | contribs)   00:19, 2 March 2012

"Before: ... *After:* ..."

Status & tagging log