Page MenuHomePhabricator

PHP Deprecated: Use of PersonalUrls hook (used in onPersonalUrlsConfirmAccount) was deprecatedInvestigate
Closed, ResolvedPublic

Description

We now have a load of logspam of the form:

[warning] [error] [029390f16854501a2899b232] /wiki/Special:Version   PHP Deprecated: Use of PersonalUrls hook (used in onPersonalUrlsConfirmAccount) was deprecated in MediaWiki 1.39. [Called from MediaWiki\HookContainer\HookContainer::run]

We'd like to suppress this

Event Timeline

I'm wondering if this as actually more than just a deprecated method. It appears to me that this might be causing some issue. While investigating TBC I noticed that when trying to load a problematic page I saw these errors in the logs:

{
  "textPayload": "[warning] [error-json] {\"id\":\"7c7dad14242f9dca7946d0ff\",\"type\":\"ErrorException\",\"file\":\"/var/www/html/w/includes/HookContainer/HookContainer.php\",\"line\":137,\"message\":\"PHP Deprecated: Use of PersonalUrls hook (used in onPersonalUrlsConfirmAccount) was deprecated in MediaWiki 1.39. [Called from MediaWiki\\\\HookContainer\\\\HookContainer::run]\",\"code\":0,\"url\":\"/wiki/Item:Q160\",\"caught_by\":\"mwe_handler\",\"backtrace\":[{\"function\":\"handleError\",\"class\":\"MWExceptionHandler\",\"type\":\"::\",\"args\":[\"integer\",\"string\",\"string\",\"string\",\"array\"]},{\"file\":\"/var/www/html/w/includes/debug/MWDebug.php\",\"line\":381,\"function\":\"trigger_error\",\"args\":[\"string\",\"integer\"]},{\"file\":\"/var/www/html/w/includes/debug/MWDebug.php\",\"line\":352,\"function\":\"sendRawDeprecated\",\"class\":\"MWDebug\",\"type\":\"::\",\"args\":[\"string\",\"boolean\",\"string\"]},{\"file\":\"/var/www/html/w/includes/debug/MWDebug.php\",\"line\":233,\"function\":\"deprecatedMsg\",\"class\":\"MWDebug\",\"type\":\"::\",\"args\":[\"string\",\"string\",\"string\",\"integer\"]},{\"file\":\"/var/www/html/w/includes/GlobalFunctions.php\",\"line\":765,\"function\":\"deprecated\",\"class\":\"MWDebug\",\"type\":\"::\",\"args\":[\"string\",\"string\",\"string\",\"integer\"]},{\"file\":\"/var/www/html/w/includes/HookContainer/HookContainer.php\",\"line\":334,\"function\":\"wfDeprecated\",\"args\":[\"string\",\"string\",\"boolean\"]},{\"file\":\"/var/www/html/w/includes/HookContainer/HookContainer.php\",\"line\":137,\"function\":\"callLegacyHook\",\"class\":\"MediaWiki\\\\HookContainer\\\\HookContainer\",\"type\":\"->\",\"args\":[\"string\",\"array\",\"array\",\"array\"]},{\"file\":\"/var/www/html/w/includes/HookContainer/HookRunner.php\",\"line\":3048,\"function\":\"run\",\"class\":\"MediaWiki\\\\HookContainer\\\\HookContainer\",\"type\":\"->\",\"args\":[\"string\",\"array\",\"array\"]},{\"file\":\"/var/www/html/w/includes/skins/SkinTemplate.php\",\"line\":582,\"function\":\"onPersonalUrls\",\"class\":\"MediaWiki\\\\HookContainer\\\\HookRunner\",\"type\":\"->\",\"args\":[\"array\",\"Title\",\"MediaWiki\\\\Skin\\\\Timeless\\\\SkinTimeless\"]},{\"file\":\"/var/www/html/w/includes/skins/SkinTemplate.php\",\"line\":1262,\"function\":\"buildPersonalUrls\",\"class\":\"SkinTemplate\",\"type\":\"->\",\"args\":[\"boolean\"]},{\"file\":\"/var/www/html/w/includes/skins/SkinTemplate.php\",\"line\":790,\"function\":\"buildContentNavigationUrlsInternal\",\"class\":\"SkinTemplate\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/w/includes/skins/SkinTemplate.php\",\"line\":762,\"function\":\"getPortletsTemplateData\",\"class\":\"SkinTemplate\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/w/includes/skins/Skin.php\",\"line\":667,\"function\":\"getCategoryLinks\",\"class\":\"SkinTemplate\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/w/includes/skins/SkinTemplate.php\",\"line\":259,\"function\":\"getCategories\",\"class\":\"Skin\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/w/includes/skins/SkinTemplate.php\",\"line\":146,\"function\":\"prepareQuickTemplate\",\"class\":\"SkinTemplate\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/w/includes/skins/SkinTemplate.php\",\"line\":177,\"function\":\"generateHTML\",\"class\":\"SkinTemplate\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/w/includes/OutputPage.php\",\"line\":2876,\"function\":\"outputPage\",\"class\":\"SkinTemplate\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/w/includes/MediaWiki.php\",\"line\":922,\"function\":\"output\",\"class\":\"OutputPage\",\"type\":\"->\",\"args\":[\"boolean\"]},{\"file\":\"/var/www/html/w/includes/MediaWiki.php\",\"line\":562,\"function\":\"main\",\"class\":\"MediaWiki\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/w/index.php\",\"line\":54,\"function\":\"run\",\"class\":\"MediaWiki\",\"type\":\"->\",\"args\":[]},{\"file\":\"/var/www/html/w/index.php\",\"line\":50,\"function\":\"wfIndexMain\",\"args\":[]}]}",
  "insertId": "31krgev0v8lpmfbq",
  "resource": {
    "type": "k8s_container",
    "labels": {
      "namespace_name": "default",
      "project_id": "wikibase-cloud",
      "container_name": "mediawiki",
      "pod_name": "mediawiki-139-app-web-5b64d94c46-zpjm4",
      "location": "europe-west3-a",
      "cluster_name": "wbaas-3"
    }
  },
  "timestamp": "2023-04-18T08:19:51.499605218Z",
  "severity": "ERROR",
  "labels": {
    "k8s-pod/app_kubernetes_io/component": "app-web",
    "k8s-pod/pod-template-hash": "5b64d94c46",
    "k8s-pod/app_kubernetes_io/name": "mediawiki",
    "compute.googleapis.com/resource_name": "gke-wbaas-3-n2-highmem-16-pool-85ebecb9-8r1o",
    "k8s-pod/app_kubernetes_io/instance": "mediawiki-139"
  },
  "logName": "projects/wikibase-cloud/logs/stderr",
  "receiveTimestamp": "2023-04-18T08:19:56.401987819Z"
}
Tarrow renamed this task from Do not log deprecated method errors in Mediawiki to PHP Deprecated: Use of PersonalUrls hook (used in onPersonalUrlsConfirmAccount) was deprecatedInvestigate .Apr 18 2023, 8:27 AM

Change 911315 had a related patch set uploaded (by Dat Nguyen; author: Dat Nguyen):

[mediawiki/core@REL1_39] DMN: make deprecated hook PersonalUrls silent

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

I looked a bit into this and saw in the 1.39 Release notes that it is recommended to use another Hook https://github.com/wikimedia/mediawiki/blob/REL1_39/RELEASE-NOTES-1.39#L403

So we could just rewrite our Hook function a little bit to use the new one: https://www.mediawiki.org/wiki/Manual:Hooks/SkinTemplateNavigation::Universal#Examples

But also I noticed that this possibly isn't even needed anymore, since the RequestAccount link is still there even if you just remove our usage of the Hook.

So my advice would be to do one of the following:

  • rewrite the hook function and use the SkinTemplateNavigation Hook instead

or

  • just remove it and check that the link to request an account is still there

Here is the PR based on Deniz's suggestion. It seems to work fine but I need some extra review

https://github.com/wbstack/mediawiki/pull/351

dang removed dang as the assignee of this task.Apr 26 2023, 1:35 PM
dang subscribed.

Here is the PR based on my idea, which make the deprecated hook PersonalUrls silent. It doesn't tackle the root of the problem but at least it can theoretically stop GG Cloud from complaining. But github is not happy with it, I'm still checking

https://github.com/wbstack/mediawiki/pull/352

deployed to staging, works excellent

Evelien_WMDE claimed this task.

Change #911315 abandoned by Reedy:

[mediawiki/core@REL1_39] DMN: make deprecated hook PersonalUrls silent

Reason:

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