Page MenuHomePhabricator

Unable to view source of empty protected page, have a message explaining why
Open, Needs TriagePublicFeature

Description

Steps to reproduce:
Visit https://meta.wikimedia.org/w/index.php?title=Template:H:Interwiki_linking&action=edit&oldid=322919 without the permission to edit

Expected result:
Like https://meta.wikimedia.org/w/index.php?title=Template:H:Interwiki_linking&action=edit, the source is shown, but not editable, or a message is shown explaining why there is no source

Actual result:
Permission error, source is not shown nor a message explaining why not

Event Timeline

Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald Transcript
DannyS712 changed the subtype of this task from "Task" to "Bug Report".

There's no $content to show. That's the correct behavior; we don't show empty source window.
At the time of that oldid, the only remaining content "{{d}}" was removed thus leaving the page blank at that revision. On edit action, if there's no $content and no permission, relevant permission error will be thrown so as to end everything early.

There's no $content to show. That's the correct behavior; we don't show empty source window.
At the time of that oldid, the only remaining content "{{d}}" was removed thus leaving the page blank at that revision. On edit action, if there's no $content and no permission, relevant permission error will be thrown so as to end everything early.

If we don't show empty source windows, there should at least be a message that its empty

That should be a separate enhancement request. The behavior in this report, as pointed out, is intentional and has been so for a long time.

DannyS712 renamed this task from Unable to view source of old revision of protected page to Unable to view source of old revision of protected page, have a message explaining why.Apr 11 2020, 6:29 AM
DannyS712 renamed this task from Unable to view source of old revision of protected page, have a message explaining why to Unable to view source of empty protected page, have a message explaining why.
DannyS712 updated the task description. (Show Details)
DannyS712 changed the subtype of this task from "Bug Report" to "Feature Request".

This is caused by this code in EditPage.php:

		# Use the normal message if there's nothing to display
		if ( $this->firsttime && ( !$content || $content->isEmpty() ) ) {
			$action = $this->mTitle->exists() ? 'edit' :
				( $this->mTitle->isTalkPage() ? 'createtalk' : 'createpage' );
			throw new PermissionsError( $action, $permErrors );
		}

I tried deleting it, and got the normal message with an empty textfield.

However, this seems to have been implemented intentionally, it was added in 2011 in this commit: rMWd83c2a431c2a: Some cleanup to EditPage: * Added displayPermissionsError() to show the…. I don't understand why it was done this way, we should try to find out before we start messing with it.

By the way, T50935 might be the same bug.