Foxtrott has uploaded a new change for review.
https://gerrit.wikimedia.org/r/64515
Change subject: bugfix (Exception: Serialization of 'Closure' is not allowed)
......................................................................
bugfix (Exception: Serialization of 'Closure' is not allowed)
Back in 2011 there was a problem where when a form was parsed bits of parser
data (e.g. JavaScript links) were
included twice in the ParserOutput. What exactly the problem was and how it can
be reproduced is not clear
anymore.
The solution back then was to deep clone the parser by serializing and
unserializing it and then use the clone
for parsing the form. Just using a new Parser object was not possible as it
misses the parser state from earlier
operations on the parser, e.g. by the MW core or other extensions.
In recent MediaWiki versions closures were introduced in the Parser (and/or its
member variables), so
serialization now throws an exception. This patch removes the deep cloning, so
that for parsing the form the
original parser is used again. This will likely lead to the old problematic
behaviour, which will have to be
fixed without using serialization.
Change-Id: I1262d2c9d478790e757abc42b0de017dafb4666b
---
M includes/SF_FormPrinter.php
1 file changed, 7 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SemanticForms
refs/changes/15/64515/1
diff --git a/includes/SF_FormPrinter.php b/includes/SF_FormPrinter.php
index b7b5611..c4f9ee1 100644
--- a/includes/SF_FormPrinter.php
+++ b/includes/SF_FormPrinter.php
@@ -435,12 +435,14 @@
$wgOut->addHTML( "\n<hr />\n" );
}
- $oldParser = $wgParser;
+// $oldParser = $wgParser;
- $wgParser = unserialize( serialize( $oldParser ) ); // deep
clone of parser
- $wgParser->Options( ParserOptions::newFromUser( $wgUser ) );
+// $wgParser = unserialize( serialize( $oldParser ) ); // deep
clone of parser
+ if ( !$wgParser->Options() ) {
+ $wgParser->Options( ParserOptions::newFromUser( $wgUser
) );
+ }
$wgParser->Title( $this->mPageTitle );
- $wgParser->clearState();
+// $wgParser->clearState();
$form_def = SFFormUtils::getFormDefinition( $wgParser,
$form_def, $form_id );
@@ -1613,7 +1615,7 @@
$parserOutput = $wgParser->getOutput();
$wgOut->addParserOutputNoText( $parserOutput );
- $wgParser = $oldParser;
+// $wgParser = $oldParser;
wfProfileOut( __METHOD__ );
--
To view, visit https://gerrit.wikimedia.org/r/64515
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I1262d2c9d478790e757abc42b0de017dafb4666b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SemanticForms
Gerrit-Branch: master
Gerrit-Owner: Foxtrott <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits