Page MenuHomePhabricator

Special:NewItem redirects to https://www.wikidata.org/wiki/NewItem after clicking "create" following a "already exists" message
Closed, DuplicatePublic

Description

Reproduce:

  1. https://www.wikidata.org/wiki/Special:NewItem
  2. put some values for label and descriptions that already exists, like English language, label:Auto, description:company (it's https://www.wikidata.org/wiki/Q4826088)
  3. click "create" and you'll get "Item Q4826088 already has label "Auto" associated with language code en, using the same description text. "
  4. then click again "create" and you're forwarded to https://www.wikidata.org/wiki/NewItem

Event Timeline

Stryn raised the priority of this task from to Needs Triage.
Stryn updated the task description. (Show Details)
Stryn added a project: Wikidata.
Stryn added a subscriber: Stryn.

Still happening, what is needed to fix this?

I have just done a quick investigation: after submitting the form according to the steps, the HTML source contains <form action="/wiki/NewItem"> instead of <form action="/wiki/Special:NewItem"> (which is there when you open an empty for). If I fix the source code and try to submit, it behaves correctly.

The action attribute comes from HTMLForm::getAction() which calls $this->getTitle()->getLocalURL(). So there is some problem with the title.

A quick solution could be like:

// SpecialNewEntity::createForm
/**
 * @return HTMLForm
 */
private function createForm() {
  return HTMLForm::factory( 'ooui', $this->getFormFields(), $this->getContext() )
    ->setTitle( SpecialPage::getTitleFor( $this->getName() ) )
  // ...

However, this fixes the reported problem but not the actual problem.

Still happening. I share with you a debug file documenting this issue in a fresh installation. I hope it can be helpful.