Lucas_Werkmeister_WMDE added a comment.

  This can be reproduced locally by making the main namespace an entity 
namespace (which is the case on Wikidata, but typically not on local test 
wikis, which have a separate `Item:` namespace):
  
  name=LocalSettings.php
    $wgWBRepoSettings['entityNamespaces']['item'] = NS_MAIN; // testing T271402
  
  Then put the wikitext `[[d:Special:EntityPage]]` on a page and look at a diff 
where that wikitext is in the rendered page content.
  
  - `HtmlPageLinkRendererEndHookHandler::doHtmlPageLinkRendererEnd()` runs, to 
potentially add a label to links (meant to be only links in edit summaries)
  - the link has no custom text, and the request is one where labels should be 
added to links in edit summaries (a diff request and not an API request), so 
`doHtmlPageLinkRendererEnd()` calls `internalDoHtmlPageLinkRendererEnd()`
  - `internalDoHtmlPageLinkRendererEnd()` tries to parse the link as a foreign 
entity ID (which fails), and returns if that fails //and if the target 
namespace is not an entity namespace//
    - because the link is an interwiki link, it is parsed as a link to the “d:” 
wiki (Wikidata), with namespace 0 (main namespace) and text 
“Special:EntityPage”; namespace 0 //is an entity namespace//
    - therefore `internalDoHtmlPageLinkRendererEnd()` does //not// return, but 
continues
  - `internalDoHtmlPageLinkRendererEnd()` asks its `linkTargetEntityIdLookup` 
to get the entity ID
  - `EntityLinkTargetEntityIdLookup::getEntityId()` determines the link is 
external and delegates to `getEntityIdFromExternalLink()`
  - `getEntityIdFromExternalLink()` splits the link text (expected to be 
something like “Special:EntityPage/Q123”, actually “Special:EntityPage”) on `/` 
into two parts and passes the second part (expected to be something like 
“Q123”, actually the second element of a one-element array, i.e. `null` with a 
PHP notice “undefined offset”) into `parseEntityId()`
  - `parseEntityId()` (rightly) complains that it was passed `null` when it 
expects a `string`

TASK DETAIL
  https://phabricator.wikimedia.org/T271402

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Rosalie_WMDE, Lucas_Werkmeister_WMDE
Cc: brennen, Lucas_Werkmeister_WMDE, WMDE-leszek, noarave, Lydia_Pintscher, 
matej_suchanek, Aklapper, Akuckartz, Iflorez, darthmon_wmde, alaa_wmde, 
Nandana, Lahi, Gq86, GoranSMilovanovic, QZanden, LawExplorer, _jensen, 
rosalieper, Scott_WUaS, Jonas, Verdy_p, Wikidata-bugs, aude, Jdforrester-WMF, 
Mbch331, Rxy, Jay8g
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to