Page MenuHomePhabricator

When an extension prevents page creation with a new section, "new section" appears in the subject box as if it was the summary
Closed, ResolvedPublicBUG REPORT

Description

See user report, which has a full list of steps.

We are pretty sure this is a mangling caused by DiscussionTools and ConfirmEdit not playing nice together.

Event Timeline

This seems to occur w/o dt

Steps:

  1. Don't be logged in
  2. Go to https://test2.wikipedia.org/w/index.php?title=Talk:T311533&action=edit&section=new&dtenable=0
  3. Enter some text in the subject box ($1)
  4. Enter https://example.com in the body
  5. Click Publish page This should interrupt you and prompt you for the CAPTCHA

What happens:
The input in the subject box ($1 from step 3 above) is changed:
FROM: $1
TO: /* $1 */ new section

What should have happened:
The input in the subject box ($1 from step 3 above) should be retained.

Xaosflux renamed this task from Captcha when creating pages causes a mangled /* new section */ to appear in the edit summary to CAPTCHA when creating pages with a new section causes unexpected text /* new section */ to appear in the subject box.Jun 28 2022, 4:58 PM
matmarex subscribed.

If anything, using DiscussionTools probably fixes this…

I can reproduce the same problem with other extensions preventing you from saving edits.

For example, with TemplateData: in step 4, enter <templatedata>{</templatedata> in the body instead, which will show an error message "Syntax error in JSON." instead of saving the page. The subject will be similarly corrupted.

Looks like a core issue to me.

matmarex renamed this task from CAPTCHA when creating pages with a new section causes unexpected text /* new section */ to appear in the subject box to When an extension prevents page creation with a new section, "new section" appears in the subject box as if it was the summary.Jun 28 2022, 7:23 PM

I had a look and the code in EditPage is very confused about whether it's dealing with an edit summary or a section title. For example, I also just found out than when using section=new while not creating a new page, the AbuseFilter summary variable will only contain the subject, rather than the generated summary (looks like it has been reported before: T191722).

I'm sure it's possible to fix this, but it's impossible to predict what else is going to be affected.

As it happens, DiscussionTools new topic tool does not have this bug (honestly, I'm a little offended that you thought that it's the cause ;) ), because it bypasses most of the broken code, so I'm not too inclined to put a lot of effort into this, given that most users already aren't (or soon won't be) using the affected interface.

Agree this is fairly low priority and this use case will decline; but it could be a bug that sticks its head up in other places unexpectedly.

When prioritizing this, please note that not all users will eventually use DiscussionTools—and not only senior contributors deliberately opting out of it won’t, but also for example users who can’t or don’t want to execute JavaScript (old browser, NoScript, organizational security settings etc.). They can well be junior contributors and thus affected by the CAPTCHA.

Change 814003 had a related patch set uploaded (by Bartosz Dziewoński; author: Bartosz Dziewoński):

[mediawiki/core@master] EditPage: Disentangle edit summary and section title

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

I wrote a patch, because that's my idea for a fun weekday night. Now you just need to find someone whose idea for a fun weekday night is to review that.

Change 814003 merged by jenkins-bot:

[mediawiki/core@master] EditPage: Disentangle edit summary and section title

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