r32487 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32486‎ | r32487 | r32488 >
Date:00:02, 27 March 2008
Author:brion
Status:old
Tags:
Comment:
* (bug 13522) Fix fatal error in Parser::extractTagsAndParams
Modified paths:
  • /branches/REL1_12/phase3/RELEASE-NOTES (modified) (history)
  • /branches/REL1_12/phase3/includes/Parser.php (modified) (history)
  • /branches/REL1_12/phase3/includes/Preprocessor_DOM.php (modified) (history)
  • /branches/REL1_12/phase3/includes/Preprocessor_Hash.php (modified) (history)

Diff [purge]

Index: branches/REL1_12/phase3/includes/Preprocessor_DOM.php
@@ -972,7 +972,7 @@
973973 $titleText = $this->title->getPrefixedDBkey();
974974 $this->parser->mHeadings[] = array( $titleText, $headingIndex );
975975 $serial = count( $this->parser->mHeadings ) - 1;
976 - $marker = "{$this->parser->mUniqPrefix}-h-$serial-{$this->parser->mMarkerSuffix}";
 976+ $marker = "{$this->parser->mUniqPrefix}-h-$serial-" . Parser::MARKER_SUFFIX;
977977 $count = $contextNode->getAttribute( 'level' );
978978 $s = substr( $s, 0, $count ) . $marker . substr( $s, $count );
979979 $this->parser->mStripState->general->setPair( $marker, '' );
Index: branches/REL1_12/phase3/includes/Parser.php
@@ -82,14 +82,17 @@
8383 const OT_WIKI = 2;
8484 const OT_PREPROCESS = 3;
8585 const OT_MSG = 3;
86 -
 86+
 87+ // Marker Suffix needs to be accessible staticly.
 88+ const MARKER_SUFFIX = "-QINU\x7f";
 89+
8790 /**#@+
8891 * @private
8992 */
9093 # Persistent:
9194 var $mTagHooks, $mTransparentTagHooks, $mFunctionHooks, $mFunctionSynonyms, $mVariables,
92 - $mImageParams, $mImageParamsMagicArray, $mStripList, $mMarkerSuffix, $mMarkerIndex,
93 - $mExtLinkBracketedRegex, $mPreprocessor, $mDefaultStripList, $mVarCache, $mConf;
 95+ $mImageParams, $mImageParamsMagicArray, $mStripList, $mMarkerIndex, $mPreprocessor,
 96+ $mExtLinkBracketedRegex, $mDefaultStripList, $mVarCache, $mConf;
9497
9598
9699 # Cleared with clearState():
@@ -124,7 +127,6 @@
125128 $this->mFunctionHooks = array();
126129 $this->mFunctionSynonyms = array( 0 => array(), 1 => array() );
127130 $this->mDefaultStripList = $this->mStripList = array( 'nowiki', 'gallery' );
128 - $this->mMarkerSuffix = "-QINU\x7f";
129131 $this->mExtLinkBracketedRegex = '/\[(\b(' . wfUrlProtocols() . ')'.
130132 '[^][<>"\\x00-\\x20\\x7F]+) *([^\]\\x0a\\x0d]*?)\]/S';
131133 $this->mVarCache = array();
@@ -560,7 +562,7 @@
561563 $inside = $p[4];
562564 }
563565
564 - $marker = "$uniq_prefix-$element-" . sprintf('%08X', $n++) . $this->mMarkerSuffix;
 566+ $marker = "$uniq_prefix-$element-" . sprintf('%08X', $n++) . self::MARKER_SUFFIX;
565567 $stripped .= $marker;
566568
567569 if ( $close === '/>' ) {
@@ -652,7 +654,7 @@
653655 * @private
654656 */
655657 function insertStripItem( $text ) {
656 - $rnd = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}-{$this->mMarkerSuffix}";
 658+ $rnd = "{$this->mUniqPrefix}-item-{$this->mMarkerIndex}-" . self::MARKER_SUFFIX;
657659 $this->mMarkerIndex++;
658660 $this->mStripState->general->setPair( $rnd, $text );
659661 return $rnd;
@@ -3220,7 +3222,7 @@
32213223 $attrText = !isset( $params['attr'] ) ? null : $frame->expand( $params['attr'] );
32223224 $content = !isset( $params['inner'] ) ? null : $frame->expand( $params['inner'] );
32233225
3224 - $marker = "{$this->mUniqPrefix}-$name-" . sprintf('%08X', $this->mMarkerIndex++) . $this->mMarkerSuffix;
 3226+ $marker = "{$this->mUniqPrefix}-$name-" . sprintf('%08X', $this->mMarkerIndex++) . self::MARKER_SUFFIX;
32253227
32263228 if ( $this->ot['html'] ) {
32273229 $name = strtolower( $name );
@@ -3415,7 +3417,7 @@
34163418 $prevlevel = 0;
34173419 $toclevel = 0;
34183420 $prevtoclevel = 0;
3419 - $markerRegex = "{$this->mUniqPrefix}-h-(\d+)-{$this->mMarkerSuffix}";
 3421+ $markerRegex = "{$this->mUniqPrefix}-h-(\d+)-" . self::MARKER_SUFFIX;
34203422 $baseTitleText = $this->mTitle->getPrefixedDBkey();
34213423 $tocraw = array();
34223424
@@ -4836,12 +4838,12 @@
48374839 break;
48384840 } else {
48394841 $out .= call_user_func( $callback, substr( $s, $i, $markerStart - $i ) );
4840 - $markerEnd = strpos( $s, $this->mMarkerSuffix, $markerStart );
 4842+ $markerEnd = strpos( $s, self::MARKER_SUFFIX, $markerStart );
48414843 if ( $markerEnd === false ) {
48424844 $out .= substr( $s, $markerStart );
48434845 break;
48444846 } else {
4845 - $markerEnd += strlen( $this->mMarkerSuffix );
 4847+ $markerEnd += strlen( self::MARKER_SUFFIX );
48464848 $out .= substr( $s, $markerStart, $markerEnd - $markerStart );
48474849 $i = $markerEnd;
48484850 }
Index: branches/REL1_12/phase3/includes/Preprocessor_Hash.php
@@ -923,7 +923,7 @@
924924 $titleText = $this->title->getPrefixedDBkey();
925925 $this->parser->mHeadings[] = array( $titleText, $bits['i'] );
926926 $serial = count( $this->parser->mHeadings ) - 1;
927 - $marker = "{$this->parser->mUniqPrefix}-h-$serial-{$this->parser->mMarkerSuffix}";
 927+ $marker = "{$this->parser->mUniqPrefix}-h-$serial-" . Parser::MARKER_SUFFIX;
928928 $s = substr( $s, 0, $bits['level'] ) . $marker . substr( $s, $bits['level'] );
929929 $this->parser->mStripState->general->setPair( $marker, '' );
930930 $out .= $s;
Index: branches/REL1_12/phase3/RELEASE-NOTES
@@ -3,6 +3,14 @@
44 Security reminder: MediaWiki does not require PHP's register_globals
55 setting since version 1.2.0. If you have it on, turn it *off* if you can.
66
 7+== MediaWiki 1.12.1 ==
 8+
 9+
 10+Changes since 1.12.0:
 11+
 12+* (bug 13522) Fix fatal error in Parser::extractTagsAndParams
 13+
 14+
715 == MediaWiki 1.12.0 ==
816
917 This is the quarterly branch release of MediaWiki for Winter 2008.

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r32486* (bug 13522) Fix fatal error in Parser::extractTagsAndParams...brion00:00, 27 March 2008

Status & tagging log