Page MenuHomePhabricator

ApprovedRevs should not try to access to TextContent::mText
Closed, ResolvedPublic

Description

ApprovedRevs triggers an Error when:

  1. $egApprovedRevsBlankIfUnapproved = false AND
  2. a user opens an unapproved page.

This is since rMWc9231ac and also described in the parent task T155298.

In ApprovedRevsHooks::showBlankIfUnapproved( &$article, &$content ), instead of setting $content->mText = '' (which btw does not always exist, only if $content instanceof TextContent), $content should be set to a value of type WikitextContent. (I submit a patch in some minutes.)

Event Timeline

Seb35 triaged this task as Normal priority.Jan 14 2018, 5:04 PM
Seb35 created this task.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 14 2018, 5:04 PM

Change 404167 had a related patch set uploaded (by Seb35; owner: Seb35):
[mediawiki/extensions/ApprovedRevs@master] Error when displaying a blank page

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

Also, it is out of scope of this very maintenance task, but the content model should be checked more precisely. For instance, if I set ApprovedRevs in the namespace MediaWiki: and set $egApprovedRevsBlankIfUnapproved = false the patch would return a WikitextContent object, which is semantically incorrect because it should be another subclass of TextContent (perhaps I will submit a new version of the patch for that), but even worse is for very different content models, e.g. 'flow-board', it should be handled in some way by ApprovedRevs.

See also T155582 for a future deprecation of Content::getNativeData() to clearly differentiate from non-text content models.

Change 404167 merged by jenkins-bot:
[mediawiki/extensions/ApprovedRevs@master] Error when displaying a blank page

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

Seb35 closed this task as Resolved.Jan 15 2018, 5:01 PM