Page MenuHomePhabricator

Graph is storing a stdClass not a JsonDeserializable
Closed, DeclinedPublicPRODUCTION ERROR

Description

This seems to sneak past the checks added in 09c14b9dd0cc57594d7f4f5aebacb9151c69eb8c but can cause subtle bugs: ParserOutput::getExtensionData will return a stdClass on the first parser, but when the ParserOutput is fetched from cache (subsequent page visits) the value will be unserialized as an array instead of a class and so the return type of getExtensionData will be different.

Event Timeline

Change 812076 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] WIP: ensure that JsonCodec restores stdClass instances as objects not arrays

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

An alternative (see https://gerrit.wikimedia.org/r/c/mediawiki/core/+/812076) is to fix JsonCodec in core to ensure that stdClass objects are unserialized faithfully (as opposed to as arrays).

Change 818478 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] JsonCodec: add CycleDetector to detect cyclic references

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

Change 879136 had a related patch set uploaded (by C. Scott Ananian; author: Subramanya Sastry):

[mediawiki/services/parsoid@master] TOCData: workaround for non-recursive JsonCodec

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

Change 879136 merged by jenkins-bot:

[mediawiki/services/parsoid@master] TOCData: workaround for non-recursive JsonCodec

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

Change 880501 had a related patch set uploaded (by Arlolra; author: Arlolra):

[mediawiki/vendor@master] Bump parsoid to 0.17.0-a11

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

Change 880501 merged by jenkins-bot:

[mediawiki/vendor@master] Bump parsoid to 0.17.0-a11

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

Change 812076 merged by jenkins-bot:

[mediawiki/core@master] JsonCodec: fix en/decoding of nested objects and stdClass objects

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

The extension TitleIcon has a wrong unserialization since 96e4f5d8402 (more exactly the class MediaWiki\Extension\TitleIcon\Icon): see for instance the patch I am preparing, but the failing tests are independent of the patch and fail exactly when MediaWiki has 96e4f5d8402.

For now I fail to understand if something should be changed to adapt the extension or if there is an issue somewhere.

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

[mediawiki/extensions/TitleIcon@master] [WIP] Do not double-unserialize

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

I remarked there are two unserializations in IconManager, and removing the internal unserialization seems to fix the failing tests.

I’m not very comfortable since I don’t know well the extension, neither the change in the unserialization (an advice from you @cscott would be appreciated), and the logic about TitleIcon’s version versus MediaWiki’s version: if it is correct not do do the internal unserialization in MW 1.40+, either the extension must be marked as 1.40+ in extension.json either a more complex logic must be implemented.

Change 883930 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/core@master] json: Dont try to deserialize actual user-land instances

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

Change 883930 merged by jenkins-bot:

[mediawiki/core@master] json: Dont try to deserialize actual user-land instances

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

Change 883858 had a related patch set uploaded (by Thiemo Kreuz (WMDE); author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TitleIcon@master] Fix broken deserialization from page properties

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

Change 883858 merged by jenkins-bot:

[mediawiki/extensions/TitleIcon@master] Fix broken deserialization from page properties

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

Change 882192 abandoned by Seb35:

[mediawiki/extensions/TitleIcon@master] [WIP] Do not double-unserialize

Reason:

Already merged in I969d8c49106202d9eb3c59f3b4e35c3c89d4c0dd in a better form

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

@cscott Anything left to do on this ticket ? Its not entirely clear to me from the task and the tickets.

Change 932276 had a related patch set uploaded (by Cicalese; author: Thiemo Kreuz (WMDE)):

[mediawiki/extensions/TitleIcon@REL1_39] Fix broken deserialization from page properties

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

Change 932276 merged by jenkins-bot:

[mediawiki/extensions/TitleIcon@REL1_39] Fix broken deserialization from page properties

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

Umherirrender renamed this task from Graph is storing a stdClass not a JsonUnserializable to Graph is storing a stdClass not a JsonDeserializable.Jul 10 2024, 7:44 PM

@cscott: Removing task assignee as this open task has been assigned for more than two years - See the email sent to task assignee on October 11th.
Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome! :)
If this task has been resolved in the meantime, or should not be worked on by anybody ("declined"), please update its task status via "Add Action… 🡒 Change Status".
Also see https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator. Thanks!

Change #1185091 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/GrowthExperiments@master] Convert deprecated JsonDeserializable to JsonCodecable

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

Restricted Application changed the subtype of this task from "Task" to "Production Error". · View Herald TranscriptSep 5 2025, 1:22 PM

Change #1185113 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/extensions/Translate@master] Convert deprecated JsonDeserializable to JsonCodecable

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

Change #1185113 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Convert deprecated JsonDeserializable to JsonCodecable

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

Change #1185091 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] Convert deprecated JsonDeserializable to JsonCodecable

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

Change #818478 abandoned by Hashar:

[mediawiki/core@master] JsonCodec: add CycleDetector to detect cyclic references

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

Change #818478 restored by Thcipriani:

[mediawiki/core@master] JsonCodec: add CycleDetector to detect cyclic references

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