Brian Wolff has uploaded a new change for review.

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


Change subject: Update Parser::mPreprocessor->parser reference when Parser is 
cloned
......................................................................

Update Parser::mPreprocessor->parser reference when Parser is cloned

If the first time someone is trying to transform a message is
during the parsing of something else, Parser will get cloned
well in a parsing state. However, Parser::mPreprocessor is
not updated or cloned. Thus it will point to the wrong
instance of Parser. If a strip item gets inserted, it could
get inserted with the wrong uniq prefix, which causes an
exception to be thrown. (This actually does happen in certain
rare ases when the translate extension is being used).

There's some code in Parser::clearState that looks like its
meant to work around this issue, but isn't sufficient.
I don't think its needed anymore, but left it there just to
be safe.

Bug: 56226
Change-Id: I8284b59de2d9c776c3439b966614717e680345d1
---
M includes/parser/Parser.php
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/53/92253/1

diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php
index 1f14223..1f5d9ed 100644
--- a/includes/parser/Parser.php
+++ b/includes/parser/Parser.php
@@ -254,6 +254,9 @@
         * Allow extensions to clean up when the parser is cloned
         */
        function __clone() {
+               if ( isset( $this->mPreprocessor ) ) {
+                       $this->mPreprocessor->parser = $this;
+               }
                wfRunHooks( 'ParserCloned', array( $this ) );
        }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8284b59de2d9c776c3439b966614717e680345d1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to