Page MenuHomePhabricator

Objects in ParserCache’s ExtensionData are not unserialized
Closed, ResolvedPublicBUG REPORT

Description

What happens?:

When I wrote the patch for SemanticMediaWiki to use JSON serialization instead of the PHP one in ParserCache as proposed by T263579, the patch for SemanticMediaWiki to use JSON serialization instead of the PHP one, the object is correctly serialized, but the unserialization has not effect: in the resulting ParserOutput object, the key $parserOutput->mExtensionData['smwdata'] is an array instead of an object.

It can be observed with a debugger (or a var_dump) by observing $parserOutput['smwdata'] in ParserOutput::newFromJsonArray() when Semantic MediaWiki is installed in the version of the PR.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:

Event Timeline

I tracked down the issue in I5785596d68/b956c77d2 by @Pchelolo, and it seems there is an issue in ParserOutput since the same variable is overriden:

$this->mExtensionData = $unserializer->unserializeArray( $jsonData['ExtensionData'] ?? [] );
$this->mExtensionData = $jsonData['ExtensionData'];

The correct version is probably to remove the second line: it correctly unserializes objects as objects.

Seb35 renamed this task from Objects in ExtensionData’s ParserCache are not unserialized to Objects in ParserCache’s ExtensionData are not unserialized.Sep 17 2021, 9:31 AM

Change 721772 had a related patch set uploaded (by Seb35; author: Seb35):

[mediawiki/core@master] Unserialize objects in ParserCache->mExtensionData as objects

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

Change 721772 merged by jenkins-bot:

[mediawiki/core@master] Unserialize objects in ParserCache->mExtensionData as objects

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

Change 721832 had a related patch set uploaded (by Seb35; author: Seb35):

[mediawiki/core@REL1_36] Unserialize objects in ParserCache->mExtensionData as objects

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

Change 721833 had a related patch set uploaded (by Seb35; author: Seb35):

[mediawiki/core@REL1_37] Unserialize objects in ParserCache->mExtensionData as objects

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

Change 721832 merged by jenkins-bot:

[mediawiki/core@REL1_36] Unserialize objects in ParserCache->mExtensionData as objects

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

Change 721833 merged by jenkins-bot:

[mediawiki/core@REL1_37] Unserialize objects in ParserCache->mExtensionData as objects

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

Seb35 claimed this task.